Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

[Type here]

TASK 6 DSP
Name: Kotha Hemanth Kumar
Reg.No: 18BEC0307
Name: Kotha Hemanth Kumar
Reg.No: 18BEC0307

1.Write a MATLAB program to find the 8 point of the given


Sequence using decimation in Frequency.

MATLAB Code:
x=input('Enter the Sequence: ');
N=input('Enter Lenght/Size of Sequence: ');
a=length(x);
if(a<N)
x=[x zeros(1,(N-a))];
end;
x=bitrevorder(x);
n=log2(N);
X=zeros(1,N);
for m=1:1:n
l=2^(m-1);
i=1;
while(i<=(N-l))
for k=0:1:(l-1)
X(i)=x(i)+x(i+l)*exp(-j*2*pi*k/N*(2^(n-m)));
X(i+l)=x(i)-x(i+l)*exp(-j*2*pi*k/N*(2^(n-m)));
i=i+1;
if(k==(l-1))
i=i+l;
end;
end;
end;
x=X
end;
disp(['Output: ',num2str(X)]);
p=abs(X);
q=angle(X);
subplot(311);
stem(x);
xlabel('time');
ylabel('magnitude');
title('original sequence');
subplot(312);
stem(p);
xlabel('frequency');
ylabel('magnitude');
title('magnitude spectrum of dft');
subplot(313);
stem(q);
xlabel('frequency');
ylabel('phase');
title('phase spectrum of dft');
Name: Kotha Hemanth Kumar
Reg.No: 18BEC0307

Sequence Used [-1 0 2 0 -4 0 2 0]


N = 8
DIM = 2
MATLAB Outputs:
Name: Kotha Hemanth Kumar
Reg.No: 18BEC0307

Graph:
Name: Kotha Hemanth Kumar
Reg.No: 18BEC0307

Manual Verify:

You might also like