Question

Later in the semester it will become useful to determine the frequency response of a signal or system by taking the Fourier Transform empirically (rather than computing it analytically). To

do so we make use of the fft and fftshift commands. The fft command is an efficient implementation of the Discrete Fourier Transform (DFT) known as the Fast Fourier Transform (FFT). When the FFT is computed the samples are not ordered properly and thus the fftshift command is called to re-order the samples correctly. Then, to get the magnitude response of the system we again use the abs command (or angle for the phase response). the abs command (or angle for the phase response).Let's compute the Fourier Transform for a system described by a rectangular function, i.e., take h[n] = u[n+10]–u[n-11].For reasons that will become clear later, when we create our discrete sequence we pad the sequence with zeros on each side. In MATLAB enter the following commands to define h[n], take the Fourier Transform of it, and then plot the corresponding magnitude response of the system: n = -100:100; > h = 0*n; h(91:111) = 1;= 1; >> w = linspace(-pi , pi ,l1024); -> H = fftshift (fft (h,1024)); - figure (4); > subplot (2,1,1); - stem (n,h,'filled '); > axis([-100 100 0 1.5]); xlabel('$$n$$ ' , ' interpreter ','latex '); > title ('$$h [n] $$ ', 'interpreter ','latex '); >> subplot ( 2,1,2); > plot (w, abs (H)); > axis ([- pi pi 0 25]); • xlabel('$$\omega$$','interpreter ','latex '); >title ('$$ |H(e^{j\omega})|$$ ', 'interpreter ', 'latex '); A few things to note here are that we explicitly specify that the FFT be computed using 1024 points (rather than the default 201 points that is the length of h). This helps to improve the resolution of the frequency response and we will study why that is later in the semester. We create a plotting vector for w to have the same number of samples between[-7,7] and then use the plot command to display the magnitude response, similar to when we plotted the analytic magnitude response in Exercise 3.

Question image 1Question image 2Question image 3Question image 4Question image 5Question image 6Question image 7Question image 8Question image 9Question image 10Question image 11Question image 12Question image 13Question image 14Question image 15Question image 16Question image 17Question image 18