Answer to Question #163358 in MatLAB for Pratyush

Question #163358

Write a program to compute the N-point inverse-DFT (IDFT) of a sequence. DO not use the inbuilt command. Test your program on the DFTs of the sequences in the previous part.


1
Expert's answer
2021-02-12T18:15:52-0500
close all;
clear all;

t = (-1:1:10);
unitstep = t>=4;
x=unitstep;

L=length(x);
D_x=zeros(1,L);
Inv_D_x=zeros(1,L);

i=sqrt(-1);

for k=0:L-1
for n=0:L-1
D_x(k+1)=D_x(k+1)+(x(n+1)*exp((-i)*2*pi*k*n/L));
end
end

t=0:L-1;
subplot(2,2,1);
stem(t,x);
title('Original signal x[n]')
ylabel ('Amplitude');
grid
xlabel ('Time (sec)');

MAG=abs(D_x);
t=0:L-1;
subplot(2,2,2);
stem(t,MAG);

title('Magnitude Response')
ylabel ('Amplitude');
grid
xlabel ('Samples (K)');

Phi=angle(D_x);

t=0:L-1;
subplot(2,2,3);
stem(t,Phi);
title('Phase Response')
ylabel ('Phase');
grid
xlabel ('Samples (K)');

for n=0:L-1
for k=0:L-1
Inv_D_x(n+1)=Inv_D_x(n+1)+(D_x(k+1)*exp(i*2*pi*k*n/L));
end
end
Inv_D_x=Inv_D_x./L;

t=0:L-1;
subplot(2,2,4);
stem(t,Inv_D_x);
title('Inverse DFT signal x_hat[n]')
ylabel ('Amplitude');
grid
xlabel ('Time ');

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS