Matlab question It is difficult to identify the frequency co
Matlab question:
It is difficult to identify the frequency components by looking at the original signal in the time domain. We can analyze the signal in the frequency domain using Matlab tools or FFT Let the sampling frequency be 8 kHz, and the time t varies from 0 to 1 second. Create and plot the signal y(t) 3sin(2 pi f_1 t) sin(2 pi f_2 t) where f_1 = 697 Hz and f_2 = 1209 Hz. Properly zoom-in so that we can see the sine wave pattern in your plot Plot the frequency spectrum of y(t) using Matlab\'s spectral estimation tool. Put markers in the plot to show the main frequency components of the signal. Re-do (b) using Matlab\'s sptool Re-do (b) using FFT. Properly label your axis.Solution
%% Time specifications: Fs = 100; % samples per second dt = 1/Fs; % seconds per sample StopTime = 1; % seconds t = (0:dt:StopTime-dt)\'; N = size(t,1);
%% Sine wave: Fc = 12; % hertz x = cos(2*pi*Fc*t);
%% Fourier Transform: X = fftshift(fft(x));
%% Frequency specifications: dF = Fs/N; % hertz f = -Fs/2:dF:Fs/2-dF; % hertz
%% Plot the spectrum: figure; plot(f,abs(X)/N); xlabel(\'Frequency (in hertz)\'); title(\'Magnitude Response\');
