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

This is a MatLab program Can you please comment on some parts of the program. Th

ID: 3720286 • Letter: T

Question

This is a MatLab program

Can you please comment on some parts of the program. Thanks!

Finding the Magnitude Spectrum of a Signal through the use of the DFT a) Synthetise a 400 Hz and 1200 Hz sinusoidal signal of 1 second duration at Fs 8000Hz. b) Use the sound command to hear both signals. Adjust the command using the appropriate Fs. c Find the magnitude spectrum of this signal using the DFT. Plot the magnitude spectral profiles using a k-axis, a f-axis in Hertzs and a ?-axis in rad/samp. d) Verify whether the spectral peaks appear at the right frequencies. Before taking the spectrum zero pad to the nearest power of two. Are there any other spectral peaks besides the 400Hz and the 1200Hz peaks. Explain. Now look at the magnitude spectrum of the signal when you only use half of the signal to find its spectrum, then use aproximately 1/32 of the signal, 1/64, 1/512 and 1/1000 of the signal. Are the spectral peaks as sharp as before or do they become more "smeared" as less and less points are used? Discuss. Make sure you zero pad the truncated versions of the signal to at least 16384 points in order to have a smooth spectrum. e)

Explanation / Answer

%%_______________matlab code. copy paste it and save it .then run it_______________

function DSP
clc;
clear;
Fs=8000;
t=0:1/(Fs):1;
%%%%a) signal generation%%%
sig1= sin(2*pi*400*t);
sig2= sin(2*pi*1200*t);
%%%% b) playing sound
sound(sig1,Fs);
sound(sig2,Fs);
%%%% c)DFT
y1= fft(sig1, 8192);
y2= fft(sig2, 8192);
f=1:1:4096;
y1_1=zeros(4096);
y1_1= y1(1:4096);
y2_2= zeros(4096);
y2_2= y2(1:4096);
%% plotting as afunction of frequency
plot(f,abs(y1_1)/4096);
title('Single-Sided Amplitude Spectrum of 400Hz sinusoid');
xlabel('f (Hz)');
ylabel('|signal_1(f)|');
figure, plot(f,abs(y2_2)/4096);
title('Single-Sided Amplitude Spectrum of 1200Hz sinusoid');
xlabel('f (Hz)');
ylabel('|signal_2(f)|');
%% plotting as funtion of k
figure, plot(abs(y1_1));
title('Single-Sided Amplitude Spectrum of 400Hz sinusoid');
xlabel('k');
ylabel('|signal_1(f)|');
figure, plot(abs(y2_2));
title('Single-Sided Amplitude Spectrum of 1200 Hz sinusoid');
xlabel('k');
ylabel('|signal_1(f)|');

%%%%% d) zero padding and DFT
sgn_1= zeros(8192);
sgn_1=sig1;
sgn_2= zeros(8192);
sgn_2= sig2;

y1= fft(sgn_1, 8192);
y2= fft(sgn_2, 8192);
f=1:1:4096;
y1_1=zeros(4096);
y1_1= y1(1:4096);
y2_2= zeros(4096);
y2_2= y2(1:4096);
%% plotting as afunction of frequency
plot(f,abs(y1_1)/4096);
title('Single-Sided Amplitude Spectrum of 400Hz sinusoid after zero padding');
xlabel('f (Hz)');
ylabel('|signal_1(f)|');
figure, plot(f,abs(y2_2)/4096);
title('Single-Sided Amplitude Spectrum of 1200Hz sinusoid after zero padding');
xlabel('f (Hz)');
ylabel('|signal_2(f)|');

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote