dtfs.docx
TRANSCRIPT
![Page 1: DTFS.docx](https://reader036.vdocuments.us/reader036/viewer/2022083007/563dbac1550346aa9aa7c4b0/html5/thumbnails/1.jpg)
clc;
clear all;
close all;
x=input('enter the samples x[n]');
N=length(x);
for k=1:N
for n=1:N
w(k,n)=(1/N)*exp(-j*((2*pi)/N)*(n-
1)*(k-1));
end;
end;
x=transpose(x);
c=w*x;
disp('magnitude spectrum');
disp(transpose(c));
c1=angle(c)*(180/pi);
disp('phase spectrum');
disp(transpose(c1));
M=[1:N];
subplot 311;
stem(M,x);
xlabel('n');
ylabel('x[n]');
subplot 312
stem(M,abs(c));
xlabel('n');
ylabel('|c[n]|');
subplot 313
stem(M,c1);
xlabel('n');
ylabel('<c[n]');
OUTPUT:
Enter the samples x[n]
[1 0 0 0]
Magnitude spectrum
0.2500 0.2500 0.2500 0.2500
Phase spectrum
0 0 0 0
![Page 2: DTFS.docx](https://reader036.vdocuments.us/reader036/viewer/2022083007/563dbac1550346aa9aa7c4b0/html5/thumbnails/2.jpg)
1 1.5 2 2.5 3 3.5 40
0.5
1
n
x[n]
SAMPLE SEQUENCE
1 1.5 2 2.5 3 3.5 40
0.2
0.4
n
|c[n
]|
MAGNITUDE SPECTRUM
1 1.5 2 2.5 3 3.5 4-1
0
1
n
<c[n
]
PHASE SPECTRUM