HW9 (9.1 – 9.4) Solution

$30.00 $24.00

9.1 Fourier Analysis: Nyquist Frequency and Aliasing CONCEPTS 4 pts a)  Consider the func1on from problem 8.3: f(t) = 3 + 1.2 sin(2 π t /3) – 3.5 sin(2 π t) + 2.5 cos(4 π t). – What’s the Nyquist frequency of the func1on? – What’s the minimum number of DFT “points” (value of 2N)…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

9.1 Fourier Analysis: Nyquist Frequency and Aliasing CONCEPTS

4 pts

a)

Consider the func1on from problem 8.3: f(t) = 3 + 1.2 sin(2 π t /3) – 3.5 sin(2 π t) + 2.5 cos(4 π t).

What’s the Nyquist frequency of the func1on?

What’s the minimum number of DFT “points” (value of 2N) you would have to use over one period to reproduce the signal exactly (i.e. no aliasing)?

b) Consider the exact “railway track pulse” mo1on you analyzed in 8.5 – 8.7.

What’s the Nyquist frequency of the func1on?

What’s the minimum number of “points” (value of 2N) you would have to use over one

period, 0 ≤ t < 2 s, for the DFT in 8.7 to reproduce the analy1c signal exactly (i.e. no aliasing)? (Show your work above and jusBfy your answers. Unjus1fied answers get no grade.)

9.2 Fourier Analysis: Nyquist Frequency and Aliasing in MATLAB

6 pts By now I’m expec1ng you’ve got everything sorted out in 8.7 for automa1cally using the fft command for analyzing discrete data (for any func1on f(t)), so you should be able to use the same script, with minimal changes, to quickly do this analysis and make these plots!

Consider the func1on from problem 8.3: f(t) = 3 + 1.2 sin(2 π t /3) – 3.5 sin(2 π t) + 2.5 cos(4 π t), which is periodic with a period of τ = 3 seconds.

a) In MATLAB, sample the func1on at 6 Hz (i.e. t = 1/6 sec) for 2N = 18 points over 0 ≤ tj < τ . Remember to not include the point at t2N+1 = τ = 3.0 seconds !!!!!

•  Use fft in MATLAB to determine the coefficients of the Discrete Fourier Transform of f(tj).

•  Use these coefficients to reconstruct the inverse transform of f(t) over a finely-spaced 1me vector of 1000 points over 0 ≤ tτ.

•  Make a plot (called HW9_2a.pdf) with three things ploged on top of one another: the

original (exact) func1on in solid black, the 18 sampled data points as circles, and the reconstructed approxima1on in dashed red. A good command to use would be:

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

where t is the finely-spaced 1me vector (with 1000 points), and tj and fj the sampled data (with 18 points).

b) Redo all the steps in part (a), but this 1me use a sampling rate of 2 Hz (i.e. t = 0.5 seconds), for 2N = 6 points over the period. Call this plot HW9_2b.pdf.

Now use the results from (a) and (b) to answer the following ques1ons:

c) Compare the analy6c Fourier transform coefficients for f(t) (hint: see solu1on to HW8.3) with the discrete Fourier transform coefficients from parts (a) and (b). For each case, which coefficients are the same, and which ones are different?

d) Look at the plots you made in (a) and (b). Discuss how the “approximate” func1ons (inverse Fourier transform) compare to the exact func1on.

e) Explain why you get the differences you see. Did we do anything “bad” in one of our discrete Fourier analyses? If so … what?

Due on-paper: Answers and discussions for parts (c), (d) and (e).

Due on-line: plots HW9_2a.pdf and HW9_2b.pdf (no script, nothing in the comment box).

HW9 (9.1 – 9.4)

Concept: Machine Failure Probability

Given the “failure density” probability distribu1on f(x) of a product, the likelihood of a product to fail by 1me t, is given by the integral

F (t) = 0t f (x) dx

The integral for F(t) above returns a value between 0 (no chance of failure) and 1 (100% chance of failure) by 1me t.

The Once-ler family’s engineer has calculated a “constant failure rate” density f ( x) = λ e −λx for their thneed-making plant, with the constant value λ = 0.01 and 1me x in units of months.

The Once-ler insists their plant run trouble-free for at least 70 months (before his patent runs out and Truffula tree harves1ng becomes open to other -lers). Your goal is simply to evaluate F (70) = 70 f (x) dx

thereby calcula1ng the likelihood their plant fails before opera1ng 70 months. 0

9.3 ComputaBonal IntegraBon: Newton-Cotes Rules (By-Hand)

a) Evaluate the integral for F(70) by hand, accurate to 5 decimals, using the following two methods.

For each method, divide the whole range into seven intervals with n = 8 equally-spaced nodes.

i. Midpoint method

ii. Trapezoid method

  1. Given that the integral has the exact (analy1c) answer F(t) = 1 – eλt , calculate the percent (relaBve) error in calcula1ng F(70) for each method, and rank the two methods from best to worst.

Show all your work on paper, especially the values you’re using for all the nodes and midpoints (as appropriate, depending on the method).

9.4 ComputaBonal IntegraBon: MATLAB, and how Error Improves with More Nodes, n

8 pts

Calculate the likelihood F that the plant fails before opera1ng 70 months using two methods

(Midpoint, Trapezoid), by wri1ng three func1ons to run off one MATLAB script:

a)

Func1on 1: f = Fun(x), the func1on that outputs the integrand f(x) (i.e. the “thing” that is

to be integrated over the range x = 0 to 70).

b)

Func1on 2: Imid = Midpoint(a,b,n) that outputs the integral of Fun(x) over [a,b]

using n nodes with the Midpoint rule.

c)

Func1on 3: Itrap = Trapezoid(a,b,n) that outputs the integral of Fun(x) over [a,b]

using n nodes with the Trapezoid rule.

d)

Script: Write an m-file called HW9_4.m that …

i.

Calls Midpoint mul1ple 1mes to evaluate F using the midpoint method once for

each of the following number of nodes: n = [3 8 51 501 5001 50001].

ii.

Similarly calls Trapezoid to evaluate F using the trapezoid method for the same

values of nodes: n = [3 8 51 501 5001 50001].

iii.

Uses the exact value F(70) = 1 – e(–0.01)(70) to calculate the percent (rela1ve) error in

the approxima1ons of F from (i) and (ii).

iv. Plots the absolute value of the % error from (i) & (ii) as a func1on of interval size, h.

9.4 (conBnued …)

When done I expect to see two lines on the plot: one line for each method (midpoint & trapezoid), each with 6 values of h, similar to the plot I showed (and posted) in Class 25.

Please make each line different, so the midpoint method shows circles connected by black lines, and the Trapezoid method shows triangles connected by green lines. Be sure to use the loglog plotng command to allow details to be seen even when the error gets very small. So, use something like this plot command:

loglog(h,PctErrMid,’ok-‘, h,PctErrTrap,’^b–’)

Save this plot in pdf form as HW9_4.pdf.

Look at the plot: you should be seeing your error get very small as h gets smaller. Read values off the axis scales (by hand) to evaluate the slopes of the two lines in log-log space (i.e. the slope of log(Error) vs. log(h), like we discussed in class).

f) Finally, enter into the comment box on Carmen answers to all the following ques1ons:

i. From your approxima1on with the smallest error, what is the likelihood that the Once-ler’s plant will fail by 60 months of opera1on? (Express your answer here as a percent

e.g. F = 0.25 = 25% chance of failure).

ii. What is more accurate for this problem: midpoint or trapezoid method? Is that consistent with expecta1ons from class?

iii. What are the (approximate) slopes of each of the two lines in your log-log plot? Are they consistent with expecta1ons from class?

Hints for developing your 9.4 script and func6ons:

1) No1ce that one of the number nodes I’m asking you to do is n = 8, which is the same as what you did by-hand in 9.3. So you can use that example to double-check your MATLAB codes give the same answer as your by-hand work!

2) You should know from class qualita1vely what the plot in 9.4 should look like (it’s shape, direc1on, slope, etc.) so that should help you see if you’ve got major errors in your code.

3) I gave you a lot of hints as to how your script, func1ons and plot should look in (posted) class 25 notes. Make sure your TA gives you even more hints!

So to summarize the whole homework:

Due on-paper:

•  All of problem 9.1

•  Answers and discussions from problem 9.2 parts (c), (d) and (e)

•  All of problem 9.3

•  Nothing from 9.4

Due on-line:

•  Plots HW9_2a.pdf and HW9_2b.pdf (from Fourier problem 9.2)

•  Documented script HW9_4.m, and three func1ons: Fun.m, Midpoint.m, Trapezoid.m.

•  One plot HW9_4.pdf.

•  Answers to all three ques1ons in 9.4 part (f) in the comment box. Double-check all your informa1on is there and looks right before logging off!

HW9 (9.1 – 9.4) Solution
$30.00 $24.00