Professional Documents
Culture Documents
Instructions: Please make sure you add a title, axis labels, x-axis limit and y-axis
limit, and legend (if required) to each of your figures. You need to save the
MATLAB code and the figure in a TIFF format.
1) An input stationary signal is a combination of three sine signals. The first sine signal
has a frequency of 50 Hz, the second sine signal has a frequency of 300 Hz and the third
sine signal has a frequency of 600 Hz. Note that the individual sine signal generation has
amplitude = 1, duration = 1 second and sampling frequency (Fs) = 1000 Hz). Generate the
MATLAB plots for the following:
(iii) Spectrogram plot using the spectrogram command. Use the hamming window with
100 samples and overlapping samples as 10. Comment on your observation.
(iv) Spectrogram plot using the spectrogram command. Use the hamming window with
1000 samples and overlapping samples as 100. Comment on your observation.
2) Generate a signal with total duration of 1 sec (0 to 1 sec), in which the first 0.4 sec
(i.e., 0 to 0.4 sec) there is a sine signal of frequency 50 Hz, the signal is zero between 0.4
to 0.6 sec and the last 0.4 of the total duration, there is a sine signal of frequency 250 Hz.
Use the sampling frequency (Fs) = 1000 Hz. Generate the MATLAB plots for the
following:
(iii) Spectrogram plot using the spectrogram command. Use the hamming window with 10
samples and overlapping sample as 1. Comment on your observation.
(iv) Spectrogram plot using the spectrogram command. Use the hamming window with
500 samples and overlapping samples as 50. Comment on your observation.
1
Use the following MATLAB code to generate the spectrogram:
Suppose that the time domain signal is ‘x’ and a hamming window of ‘L’ samples needs
to be used with overlapping samples equal to ‘K’. Use the following template of
MATLAB code to generate the plots for this lab:
[S, F, T]=spectrogram(x,hamming(L),K,[0:Fs-1],Fs);
figure; imagesc(T,F,20*log10(abs(S))); colorbar;
axis xy; colormap(jet); caxis([-80 20]);
axis tight; view(0,90); xlabel('Time (Sec)'); ylabel('Frequency (Hz)');
ylim([0 500]); title('Hamming window with L Samples');