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

clear all, close all, etc fs = 1000; T = 1/fs; N = 128; n = 0; N = 1; x = sin(2*

ID: 1835554 • Letter: C

Question

clear all, close all, etc fs = 1000; T = 1/fs; N = 128; n = 0; N = 1; x = sin(2*pi*50*n*T); X = fft(x, N); y = abs[X]; f = n*(1/(N*T)); figure(1); N = 64; subplot(2,1,1), stem(f(1:N/2), y(1:N/2)); xlabel ('frequency, in HZ'); ylabel('y[n]'); fs = 1000; T = 1/fs; N = 128; n = 0; N = 1; x = cos (2*pi*250*n*T) . sin(2*pi*200*n*T); X = fft(x, N); y = abs(X); f = n*(1/(N*T)); figure(1); N = 64; stem(f(1:N), y(1:N)); xlabel('frequency, in HZ'); ylabel('x[n]'); To plot the complete spectrum from -fs/2 to +fs/2, we define the frequency range F = [-N/2:(N/2)-1]/N and, then, plot(F,X). Explain the results obtained from each plot. Modify the scripts to include the complete spectrum of each signal

Explanation / Answer

for getting a proper fft plot of ur function we have to use fftshift after using fft then u can observe the spectrum from -fs/2 to fs/2 if we use only fft then cental frequency is somewhere else please check this one