% Sampling frequency is 11025 Hz % Create a signal with two sinusoidal components % Compute frequency spectrum using DFT/FFT at % different frequency resolutions. Fs = 11025; % Sampling frequency x = [0:0.01:512]; sinx = sin(x*6*pi); % 330.75 Hz sin3x = sin(3*x*6*pi); % 992.25 Hz combined = 0.5*(sinx + sin3x); wavplay (combined, Fs); t = [0:127]/11025; % time index for the first 128 samples plot (t,combined(1:128)); % Plot the signal xlabel('Time (seconds)'); ylabel('Signal Amplitude'); title('Plot of 2-component signal'); pause; figure; N = 32; f = (0:N-1)/N*Fs; % Compute frequency scale for N = 32 plot (f,abs(fft(combined(1:32)))); % Plot frequency spectrum for N = 32 xlabel('Frequency (Hz)'); ylabel('FFT Magnitude'); title('Plot of FFT, N = 32'); pause; figure; N = 128; f=(0:N-1)/N*Fs; % Compute frequency scale for N = 128 plot (f,abs(fft(combined(1:128)))); % Plot frequency spectrum for N = 128 xlabel('Frequency (Hz)'); ylabel('FFT Magnitude'); title('Plot of FFT, N = 128'); pause; figure; N = 512; f=(0:N-1)/N*Fs; % Compute frequency scale for N = 512 plot (f,abs(fft(combined(1:512)))); % Plot frequency spectrum for N = 512 xlabel('Frequency (Hz)'); ylabel('FFT Magnitude'); title('Plot of FFT, N = 512');