- Details
- Parent Category: Programming Assignments' Solutions

# We Helped With This MATLAB Programming Assignment: Have A Similar One?

Category | Programming |
---|---|

Subject | MATLAB |

Difficulty | Undergraduate |

Status | Solved |

More Info | Engineering Homework Help |

## Short Assignment Requirements

## Assignment Description

ENTS 622 - Homework 2

HOMEWORK DUE: Week of October 30th (so either November 1st or 2nd), at the moment of handing in the quiz to your T.A. Also, deliver your programming code by this time.

PROVIDE YOUR SOLUTIONS ON THESE PAPERS (you may use front and back).

NOTE: Late submissions will receive a reduced grade. 5% for first half hour until the end of business day. Then, 10% per day, cumulatively. This restriction is necessary to be fair to students who delay their other responsibilities to hand in this homework on time.

*I understand that the
instructor has encouraged all students to work together and verbally discuss
the homework assignment, but that all work handed in must be my own, individual
work. I pledge on my honor that I have not given or received any unauthorized
assistance on this homework. I pledge that I have not intentionally used or
attempted to use unauthorized materials or information to assist me in this
homework, and I pledge on my honor that I have not looked at or read anything
from any classmate’s homework papers or scrap-material sheets.*

STUDENT NAME (required):

1. Text
Problem 3.8 Solve here:

.

2. Text
Problem 3.11 Solve here:

3. Text Problem 3.12 only part (a).

Solve here:

4. Text Problem 4.4 only part (a), and don’t bother doing the plot; just do the analytical part.

Solve here:

5. In Matlab, design a frequency tracker. You instructor will email you a file which you will downloadfrom your email, copy it to your directory where you’re running Matlab, and then load it into Matlab with the command load signal

This signal is actually a sinusoid function, with added white Gaussian zero-mean noise.

*signal*(*t*) = *cos*(2*πf _{t}t*)
+

*w*(

*t*)

*, t*∈ [0

*,t*]

_{max}In order to work in Matlab, the signal had to be sampled, and
the sampling interval for this signal is *t _{s }*= 1 · 10

^{−6 }sec.

*signal*[

*n*] =

*cos*[2

*πf*] +

_{t}n*w*[

*n*]

*,*

The peculiarity of this signal is
that its frequency, *f _{t}*,
changes exactly twice in the duration of this signal. That is to say,

*f*takes on 3 distinct values.

_{t }The noise is such that you cannot really tell what the frequencies are, or where they change just by plotting it. You must use what you’ve learned about the FFT to track the frequency of this signal. That is to say, the frequency tracker will do the following:

• estimate what the frequency of the signal is at each time, • it will also estimate when the frequency changes to a new value

• it will estimate what the new frequency is.

But, if you apply your FFT function to the entire signal to begin with, then your Fourier Transform would be detecting ALL THREE of the frequencies contained in the totality of your noisy signal, as seen in Figure 1. You won’t be able to discern when one frequency stops and the next one begins. You’ll just get three peaks identifying the three frequencies, without any idea of when one ends and the next one begins.

Figure 1: Signal has three frequencies, detected by the Fourier Transform.

So, how do you identify the three frequencies in a row? You will use a sliding window, as portrayed in Figure 2. Your program will have a loop, and in each cycle of the loop, your program will choose to select a subset of the noisy samples. It will perform your Fourier Transform analysis on that sample, it will identify the frequency of the embedded signal, and then it will loop around to do all of this again. In the next round of the loop, the window will shift to a later time (as you can see in the middle plot of Figure 2), and it will collect a new set of samples and again use Fourier Analysis to find the frequency of the embedded sinusoid.

Figure 2: A sliding window of samples, seen in red, captures only some of the samples in time for analysis.

The output of your frequency tracker, in other words, the thing that appears when I run your program, should strive to look like the second graph of Figure 3 (the bottom plot). So, your program should identify the frequency at each moment and store it in a vector. Then it will plot that vector of frequencies with respect to time.

Here are questions you must answer for yourself... THERE IS NO UNIQUE CORRECT ANSWER FOR THESE! Everyone is expected to arrive to different answers through trial and error.

• How many samples should I fit in each window? If you choose too few samples, then the frequency of the embedded signal will not be too clearly seen from among the noise in your Fourier Transform analysis. So, best not to choose a window of too few samples.

• What happens when the window of samples contains samples from two different frequencies,

Figure 3: The bottom half of this Figure shows what the frequency tracker should produce.

like the third (bottom) example in Figure 2? Won’t the Fourier Analysis detect two frequencies? Indeed, that it the case. As the window begins to pick up samples from the next segment, the presence of the next frequency will begin to influence the Fourier Analysis. There will be transient inetervals where the tracker may be unable to detect one single frequency. If the window has very many samples, then this transient interval will be long, and it will be difficult to know when the exact moment of transition from one frequency to the next may have happened. So, best not to choose a window of too many samples.

• So, too many samples in each window is bad, and too few is also bad... how many samples should be taken at a time for analysis? You must determine this by trial and error. You know, for certain that your signal changes among distinct frequencies exactly twice. So your frequency tracker should estimate exactly three frequencies. Use your best engineering judgment to make your tracker decide when each transition happened.

• Each student will receive a personalized signal, with distinct noise and transition times.

• You should deliver to your T.A. • the m-files of your frequency tracker, and • on the following page, your explanation of how your tracker works, and how precise it is to detect when the signal changes from one frequency to the next and why.

.