ECE 381: Laboratory 8 | |
Introduction to Discrete Time Systems | |
| |
1. Refer to Section M3.1 in the course textbook. Create Figures M3.1 and M3.2. Explain why Figure M3.2 looks as it does.
2. Use the stem plot in MATLAB to plot the example given in the course notes where x[n] = u[n] – u[n-5]. Also plot x[n-3] and x[-n+2] over a suitable range of n to show the functions fully.
3. Use the function in problem 3.M-1 at the end of Chapter 3. Note that the term “downsampling” is the same as decimation and “upsampling” is the same as interpolation. Plot f[n], f[2n], and f[n/2]. Plot f[n/2] in two forms – fe[n/2] and fi[n/2]. Use linear interpolation. Use a range on n from -10 to 20. It is recommended that you create a .m file here instead of trying to use an inline function as the book recommends.
Hint: Use the MATLAB the “floor” command to round down to the nearest integer. If a number is an integer multiple of L, then floor(n/L) == (n/L) will be true; otherwise it will not be true.
4. For problem (3), show the difference between the f[t/2] and fi[n/2]. Use the “plot” command here instead of the “stem” command. Use t = -10:0.01:40 and n=-10:40.
5. Given is a function x(t) = cos(1000.*pi.*t) which has a frequency of 500 Hz. Use the following commands plot sampled versions of x(t) for various sampling rates, fs. Use t=0:0.0001:0.005. Use Nmax = 0.005*(fs) and n=0:Nmax.
f=inline('cos(1000.*pi*t).*(t>=0)','t');
n = 0:1:0.005*fs;
T = 1/fs;
plot(t,f(t),'k',n.*T,f(n.*T),'bo');
stem(n,f(n.*T));
Show the plots and stem plots for sampling frequencies of 250, 500, 1000, 1500, 2000, 3000, 4000, 5000, and 10000 Hz. The sampling rate is obviously important for providing a sampled DT signal that appropriately represents the corresponding CT signal. What sampling rates do you think are needed for this to be true? This is just supposed to be a guess on your part, but also explain your answer.