clc;
clear;
close all;
n=0;20;
x=sin(0.2*pi*n);
w=-pi;0.01:pi;
x=zeros(size(w));
for k =1:length(w)
x(k)=sum(x.*exp(-1j*w(k)*n));
end
subplot(2,1,1);
plot(w/pi,abs(x));
grid on;
title('Magnitude Spectrum of Signal');
xlabel('Normalized Frequency');
ylabel( '|x(e^{j\omega})|');
subplot(2,1,2);
plot(w/pi,angle(x));
grid on;
title('phase Spectrum of Signal');
xlabel('Normalized Freqency');
ylabel('phase');

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: