代写 matlab PART A

PART A
Department of Embedded and Cyber-Physical Systems PROJECT V – Spring 2019
Control Systems for Cyber-Physical Systems (ECPS 208)
1. Choose a sinusoidal function of the form 𝑓(𝑡) = 𝐴􏰄sin(𝜔𝑡 + 𝜙). It might be good to use the same function from Project 2, to compare.
2. In order to avoid under-sampling a signal, we want to use a sampling rate that is at least twice the highest frequency we expect to see in the signal (in this case, 𝜔). Let’s see what happens when you do not meet this condition. Get 2􏰅 samples of your signal with a sampling rate less than two times the frequency of the function (play around with different rates). Get these samples such that you capture an integer number of periods exactly. What happens? Note: Be careful not to capture the same output with the first and last sample (for example, if you have sin(𝑥) then you do not need sin(𝑥 = 2𝜋) if you already have sin(𝑥 = 0)).
3. Let’s see what happens when your equipment can do the bare minimum. Get 2􏰅 samples of your function/signal with a sampling rate exactly two times the frequency of the function. What happens? Note: You might want to play around with the phase.
4. Now let’s see what happens when your measured data is periodic and not under-sampled. Get 2􏰆 samples of your function/signal such that you capture exactly two periods of your function. Plot your reconstructed signal with six periods. What happens? Note: Again, be careful not to capture the same signal with the first and last sample.
5. Now we want to see what happens when your measured data is not periodic. Use the same sampling rate as in Part 3. Get 𝑁 samples of your signal/function such that the number of integers you capture is not an integer. Plot your reconstructed signal with 3𝑁 samples at the same sampling rate. What happens? Why?
6. Sometimes we care more about finding the frequency of the signal than the reconstruction of the signal. You can mitigate the effects of spectral leakage by applying various windows to the measured data. You can type “doc window” in your MATLAB command window, to see a list of built-in window functions. While, there is no universal approach to selecting a window, the Hann window is a good place to start when dealing with sinusoidal signals. Use the h𝑎𝑛𝑛( ) function from MATLAB to apply a window to your measured data from Part 5. What happens?
7. Play around with the other built-in window functions and apply them to the measured data from Part 5. Can you find a better option than the Hann window?
EXTRA CREDIT
FFT on Noisy Data
1. Add some noise to your signal (see Project 2). Get 128 samples such that you capture 2.3 periods. Perform FFT and windowing on the measured data. Discuss your results.
2. Suppose that you want to perform FFT/windowing on the measured data above multiple times. One way to do this is by treating the measured signal as multiple signals with

lower sampling frequencies. In this case, you can get four sets of data with 32 samples. The fist set includes samples 1, 5, 9, 13, … of the original signal, the second set includes samples 2, 6, 10, 14, …, and so on. Perform FFT and windowing on each of these four data sets. Average out the amplitude of the frequency bins. Does this help?