Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

11. Using the following MATLAB commands to generate a signal sequence x which is

ID: 2081933 • Letter: 1

Question

11. Using the following MATLAB commands to generate a signal sequence x which is a mixture of two sinusoidal functions, one having a frequency fi 100 Hz, and another having fe Hz. The sampling frequency is 1 kHz. y is the signal sequence after applying a Hamming window. fl 100 f 110 sf 1000 Sampling frequency is 1 Khz 60 Total number of samples t 0: M-1 t t/sf Total duration of signal in s x cos (2 pit fl t) 1.2 cos (2 pi* f2*t pi/3) y x' *hamming (M) Windowed by a Hamming window (a) Make a plot of x and a plot of y. While y represents the Hamming-windowed signal sequence, x represents the rectangular-windowed signal sequence. (b) Perform 1024-point FFT to x and y. Make a plot of each amplitude spectrum from 0 to 200 Hz. Observe the spectral leakage and spectral blurring. Can you distinguish the two frequency components from either spectrum? (c) Now, increase M to 80, so the duration of signal, as well as the duration of window, is increased to 80 ms. Do the same things in (a) and (b). If you still cannot distinguish the two frequency components from the spectrum of the Hamming-windowed signal, further increase M to 100, 120 etc. At what M that you can start to distinguish the two frequency components from the spectrum of the Hamming windowed signal? (d) Remember that spectral blurring is caused by the main lobe a narrower main lobe produces less spectral blurring. Just as the width of the main lobe of a rectangular window is inversely proportional to the time duration of the window (see Fig. 3.7), the width of the Hamming window is also inversely proportional to the duration of the window. The above exercise shows that spectral blurring caused by a Hamming window can be effectively reduced by increasing the duration of signal to be recorded and windowed. On the other hand, there is no effective way to reduce the spectral leakage caused by a rectangular window.

Explanation / Answer

f1=100;
f2=110;
sf=1000;
M1=60;
t1=0:M1-1;
t1=t1/sf;
%section (a)
x1=cos(2*pi*f1*t1)+ 1.2*cos(2*pi*f2*t1 - pi/3);
y1=x1'.*hamming(M1);
figure;
plot(x1,y1); xlabel('original sequence M1'); ylabel('hamming windowed sequence M1');
%section (b)
n=1024;
p1=fft(x1,n);
q1=fft(y1,n);
nvs=0:sf/n:(sf-sf/n); %fft sampling
figure;
plot(nvs,abs(p1)); %fft plotting
figure;
plot(nvs,abs(q1));
%section (c)
M2=80;
t2=0:M2-1;
t2=t2/sf;
x2=cos(2*pi*f1*t2)+ 1.2*cos(2*pi*f2*t2 - pi/3);
y2=x2'.*hamming(M2);
figure;
plot(x2,y2); xlabel('original sequence M2'); ylabel('hamming windowed sequence M2');
q2=fft(y2,n);
figure;
plot(nvs,abs(q2));
title('M=80 fft')
xlabel('frequency'); ylabel('amplitude');


M3=100; %same process as above but for M=100
t3=0:M3-1;
t3=t3/sf;
x3=cos(2*pi*f1*t3)+ 1.2*cos(2*pi*f2*t3 - pi/3);
y3=x3'.*hamming(M3);
figure;
plot(x3,y3); xlabel('original sequence M3'); ylabel('hamming windowed sequence M3');
q3=fft(y3,n);
figure;
plot(nvs,abs(q3));
title('M=100 fft')
xlabel('frequency'); ylabel('amplitude');

   M4=120; % same process as above but for M = 120
t4=0:M4-1;
t4=t4/sf;
x4=cos(2*pi*f1*t4)+ 1.2*cos(2*pi*f2*t4 - pi/3);
y4=x4'.*hamming(M4);
figure;
plot(x4,y4); xlabel('original sequence M4'); ylabel('hamming windowed sequence M4');
q4=fft(y4,n);
figure;
plot(nvs,abs(q4));
title('M=120 fft')
xlabel('frequency'); ylabel('amplitude');
%section (d)
%you can diffentiate between the frequencies at M = 120.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote