HW8B (8.4 – 8.7) Solution

$30.00 $24.00

8.4 Fundamentals: POINTS to use in a Discrete Fourier Analysis, and COEFFICIENTS to calculate 5 pts Remember: when picking points you need to pick an EVEN number of points, starFng at t = 0, which end ONE t before the period. Other than that, there’s really no other rules (in this course). Look at the…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

8.4 Fundamentals: POINTS to use in a Discrete Fourier Analysis, and COEFFICIENTS to calculate

5 pts Remember: when picking points you need to pick an EVEN number of points, starFng at t = 0, which end ONE t before the period. Other than that, there’s really no other rules (in this course).

Look at the funcFon at right, with the smallest period t = 4 seconds, and consider picking 8 points to do a Fourier analysis.

  1. Just write out the values of all the Fmes tj and funcFon fj you would use in the Fourier Analysis.

  1. What are the values of t and N for this problem?

  1. List the names of all the non-trivial Fourier coefficients (As & Bs) that you would evaluate.

•  Don’t actually do the Fourier analysis or

calculate values for any coefficients;

f(t) 2

1.5

1

0.5

0

1

2

3

4

5

6

7

8

0

τ = 4 sec.

Fme

I just want a list of coefficient names (like “B0”) you would plan on calculaFng “later”.

•  Don’t include “trivial” coefficients which you already know are always zero (and wouldn’t even aZempt calculaFons for).

Due on paper: Everything.

Due on-line: Nothing.

Get off the railroad tracks!

True story – I once flew into Calgary with friends and got a car rental at midnight. New to the city, we got a liZle lost, and with no traffic downtown I accidentally turned down a ramp and ended up driving below the city roads on their light-rail transit line. Ah! The things you do with rental cars.

Clearly, it’s important we study the impact of driving on bumpy railway Fes.

The following 3 HW quesFons walk you through an invesFgaFon of the sinusoids that make up the moFon of driving over railway Fes. For f(t) we’ll use one period (τ = 2) of the “pulse” funcFon drawn below

An important feature are the disconFnuiFes at t = ¾ and 1 ¼ seconds. For all your subsequent analyses assume that f(0.75) = 1 (not 2) and f(1.25) = 2 (not 1), like the red dots and the formula below indicate.

1

0 t 0.75

2

0.75 < t 1.25

f (t ) =

1

1.25 < t 2

Use this funcFon for the next three problems:

f(t) 2

1.5

1

0.5

τ = 2 sec.

0

5 Fme 6

0

1

2

3

4

•  8.5 gets you to visualize the analyQc Fourier coefficients (given to you).

•  8.6 gets you to do a 4-point discrete Fourier transform of this funcFon, by-hand.

•  8.7 gets you to do a DFT with a large number of points using MATLAB’s built-in fft command.

HW8B (8.4 – 8.7) due – On paper and on-line.

8.5

AnalyEc Fourier DecomposiEon – VISUALIZATION.

2

3 pts

The AnalyFc Fourier series of f(t) over one period (τ = 2) is given by:

kπt

kπt

f (t) = B

+

A sin

+ B cos

where

0

k

L

k

L

1

k=1

B0 = something, Bk =

2

3k π

sin

and

Ak

= 0 for all k ≥ 1.

τ = 2 sec.

k π

4

0

a) AnalyFcally determine the value of B0 .

0

1

2

b) Use MATLAB to compare the exact pulse f(t) with an approximaEon of f(t) over one period using only the Fourier terms up to k = 20. Use a finely-spaced Fme vector of 6,000 points between 0 and 2 seconds (i.e. t=linspace(0,tau,6000)). Plot your exact f(t) in solid black, your final approximated f(t) in dashed-red, and save your plot as HW8_5.pdf with your name in the Ftle at the top (e.g. use a command like title(‘HW8.5 Dirk Pitt’) ).

Due on-line: The plot HW8_5.pdf, and your answer to “B0 = …” in the comment box. (No script.)

Due on paper: Nothing.

2

f(t)

(t3,

f3)

8.6

Discrete Fourier DecomposiEon – By Hand

(t1,

f1)

7 pts

You now sample the same pulse f(t) at 2-Hz (i.e.

t = 0.5), starFng with

1

f

1

= 1 at t

1

= 0, and gevng four discrete points (t

, f

) over one period à

(t , f

)

(t

, f

)

j

j

2 2

4

4

a)

Write out the values (tj, fj) of these four points. What’s N and 2N?

b) Use the four points in (a) to calculate (by-hand) the DFT for f(t):

0

i. Calculate all the Fourier coefficients Ak and Bk , for 0 ≤ kN,

0

1

2

ii. SubsFtute the values of the coefficients into the discrete Fourier Series representaFon of the pulse funcFon f(tj) = B0 + Σ(… etc. …), and express in a simplified form.

That’s it! You’ve done the by-hand analysis! Now let’s check that against MATLAB:

c) Use the built-in MATLAB funcFon fft to re-calculate the Discrete Fourier coefficients for the same four points. Write out on paper exactly how you used fft:

i. what vectors you created as input to the fft funcFon, ii. how you called fft ,

iii. exactly what your MATLAB output from fft was (I want you to write out all four complex values from MATLAB),

iv. and finally, exactly how you used that output to get all the relevant Ak and Bk.

Hint: There should be NO difference between the coefficients calculated in (b) and (c). If there are, you’re either having difficulty calculaFng the coefficients correctly by-hand, or else misinterpreFng the output of fft. Go back and fix the problem. A good idea to confirm you’re using fft correctly is to maybe first try it on the known 4-pt example from class.

The whole point of part (c) is to make sure you fully understand how to use and interpret the built-in fft command before moving on to the last (more complicated) quesFon, where you don’t know the “by-hand” coefficients.

Due on paper: All parts (a, b, c).

Due on-line: Nothing.

HW8B (8.4 – 8.7) due – On paper and on-line.

8.7 Discrete Fourier DecomposiEon – using MATLAB.

7 pts Go back to the “railway track” pulse f(t) in 8.5, except this Fme sample it at a higher frequency of 100 Hz (i.e. t = 1/100), over 0 ≤ t < 2 s. This is too much to do DFT calculaFons “by-hand”, so you now want to use MATLAB fft to do a discrete Fourier transformaFon of f(tj) over one period.

Before you start, consider the concepts: what is N and 2N for this problem? Exactly how many points (tj, fj) should you include in your discrete Fourier analysis? Are these meeFng the rules/ assumpFons from class? You should probably sketch out on paper what you’re trying to do (I’m not asking that to be handed in though).

Develop a documented MATLAB script HW8_7.m that does the following:

a) Creates vectors of the appropriate data points (tj, fj) for 1 ≤ j ≤ 2N. Call these vectors tj and fj.

b) Appropriately calls the fft command.

c) Uses the output from (b) to create two vectors:

i. Ak, with length N, containing all the Ak coefficients for 1 ≤ kN, ii. Bk, with length N+1, containing all the Bk coefficients for 0 ≤ kN.

d) Creates a “stem” plot of the coefficients, similar to the boZom of our “Class22_SquareWave” handout, with all the Ak to the ley, and Bk to the right. Save this plot as HW8_7stem.pdf.

e) Reconstructs an approximaFon of f(t) over one period using all these calculated Ak and Bk Fourier terms (i.e. does an “inverse transform”). The trick is that I want you to use the finely-spaced Fme vector, like in 8.5 (i.e. t=linspace(0,tau,6000)).

f) Makes a plot, called HW8_7id.pdf, similar to the top of our “Class22_SquareWave” handout, comparing this approximaFon of f(t) with the exact force f(t) over one period. Plot your exact f(t) in solid black, your approximated f(t) in dashed-red, and all your discrete points as red dots, say, with a command like:

plot(t,f_exact,’-k’, t,f_approx,’–r’, tj,fj,’or’)

This plot is a great check to see you created and interpreted all the Fourier coefficients properly because the two traces should be somewhat similar, and your inverse transform (f_approx) should exactly pass through all your discrete (tj, fj) points.

g) Look at your results for Bk and get the value for B0. NoFce that you’ve now calculated B0 for this same moFon f(t) three different ways: (i) analyFcally in 8.5, (ii) by-hand using 4 points (sampled at 2-Hz) in 8.6, and now (iii) with MATLAB using many more points sampled at 100-Hz. In the Carmen comment field, enter your values for B0 from 8.6 and 8.7 (to 4 decimals), and comment as to which one is more accurate (compared to the analyFc value).

Due on-line: your documented script HW8_7.m, two plots HW8_7stem.pdf and HW9_7id.pdf, and your answer to part (g) “B0 = … (8.6) and … (8.7)” and comment on their accuracy in the comment box.

HW8B (8.4 – 8.7) Solution
$30.00 $24.00