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




_________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .


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.