All All 'Input X (N) ' 'Period': For For

You might also like

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 2

Program

clc
close all
clear all
x=input('Input x(n)');
l=length(x)
N=input('Period');
x1=[x, zeros(1,N-l)]
for k=0:1:N-1
for n=0:1:N-1
p=exp(-i*2*pi*n*k/N)
p1(n+1, k+1)=p;
end
end
y=x1*p1
y1=abs(y)
y2=angle(y)
n=0:1:N-1
k=0:1:N-1
subplot(3,1,1)
stem(n,x1)
title ('Input')
subplot(3,1,2)
plot(k,y1)
title('Magnitude')
subplot(3,1,3)
plot(k,y2)
title('Phase')

Output

You might also like