MATLAB program to find IDFT without using MATLAB function

Program Code
%IDFT program without function
clc;
close all;
clear all;
X=input('Enter the sequence');
N=input('Enter the length of the IDFT');
len=length(X);
if N>len
    X=[X zeros(1,N-len)];
elseif N<len
    X=X(1:N);
end
i=sqrt(-1);
w=exp(-i*2*pi/N);
n=0:(N-1);
k=0:(N-1);
nk=n'*k;
W=w.^(-nk);
x=(X*W)/N;
disp(x);
subplot(211);
stem(k,abs(x));
title('Magnitude Plot');
xlabel('N');
ylabel('Amplitude');
grid on;
subplot(212);
stem(k,angle(x));
title('Phase Plot');
xlabel('N');
ylabel('Phase Angle');
grid on;


Example of Output
Enter the sequence     [24.0000       -2.3264 -13.6637i             3.0930 + 4.7651i        1.2334 - 6.2528i        1.2334 + 6.2528i 3.0930 - 4.7651i        -2.3264 +13.6637i]

Enter the length of the IDFT    4

6.1917 - 2.2247i         7.1913 + 2.0611i       5.8083 - 4.6072i   4.8087 + 4.7708i




_________________________

2 comments:

  1. thank u so much!!

    ReplyDelete
    Replies
    1. You are always welcome. It is my pleasure.
      You are always welcome to visit this humble blog of mine. I am the author of this blog. My name is Anju K.

      Delete

Please write your opinion about this MATLAB program here, only in English.

For sale

For sale
Indian currency Ten-rupee note in good condition. Issued by the Reserve Bank of India between 22 December 1992 and 21 December 1997. Serial number 52T332603 . Those interested to buy, please contact: Anju K, Email: tc9749@gmail.com . Address: 'Sreyas', House no.7/296, Pulliodi, Kathiroor village, Ponniam east PO, via Ponniam west, Thalassery, Kannur, Kerala - 670641, India.