12:24 PM

DFT of an exponentially discrete signal

function ndft()
%plots the frequency and phase spectrum of N samples of the signals

M=20; %no. of samples taken to plot each sample of the fequency and phase spectrum
N=40;
n=1:M;
x(n)=(0.5).^(n-1);
x(M+1:N)=0;

y(1:N)=0;

for k=1:N
    for n=1:M
        y(k)=y(k)+x(n)*exp(-j*2*pi*(k-1)*(n-1)/N);
    end
end

k=0:N-1;
subplot(3,1,1);
stem(k,x(k+1));
title('input');
subplot(3,1,2);
stem(k,abs(y(k+1)));
title('frequency spectrum');
subplot(3,1,3);
stem(k,angle(y(k+1)));
title('phase spectrum');
      


CHANGE THE VALUE OF N AND SEE THE DIFFERENCE

PLEASE LEAVE A COMMENT :)

0 comments:

Post a Comment