# Find DFT / IDFT of given DT signal

AIM: To find the DFT / IDFT of given signal.

Objective: To wite the MATlab code to find the DFT / IDFT of given signal.

EQUIPMENTS:

Operating System - Windows XP

Constructor - Simulator

Software - CCStudio 3 & MATLAB 7.5

MATLAB Code:

w = [0:500]*pi/500;

z = exp(-j*w);

x = 3*(1-0.9*z).^(-1);

a = abs(x);

b = angle(x)*180/pi;

subplot(2,1,1);

plot(w/pi,a);

subplot(2,1,2);

plot(w/pi,b);

Evaluate the DTFT of the given coefficients.

num=[2 1]

den=[1 –0.6]

? Plot real and imaginary parts of Fourier spectrum.

? Also plot the magnitude and phase spectrum.

MATLAB CODE:

% Evaluation of the DTFT

clc;

% Compute the frequency samples of the DTFT

w = -4*pi:8*pi/511:4*pi;

num = [2 1];

den = [1 -0.6];

h = freqz(num, den, w);

% Plot the DTFT

subplot(2,2,1)

plot(w/pi,real(h));

grid on;

title('Real part of H(e^{j\omega})')

xlabel('\omega /\pi');

ylabel('Amplitude');

subplot(2,2,2)

plot(w/pi,imag(h));

grid on;

title('Imaginary part of H(e^{j\omega})')

xlabel('\omega /\pi');

ylabel('Amplitude');

subplot(2,2,3)

plot(w/pi,abs(h));

grid on;

title('Magnitude Spectrum |H(e^{j\omega})|')

xlabel('\omega /\pi');

ylabel('Amplitude');

subplot(2,2,4)

plot(w/pi,angle(h));

grid on;

title('Phase Spectrum arg[H(e^{j\omega})]')

xlabel('\omega /\pi');

PROGRAM:

%Computation of N point DFT of a given sequence and to plot  magnitude and   phase spectrum.

N = input('Enter the the value of N(Value of N in N-Point DFT)');

x = input('Enter the sequence for which DFT is to be calculated');

n=[0:1:N-1];

k=[0:1:N-1];

WN=exp(-1j*2*pi/N);       % twiddle factor

nk=n'*k;

WNnk=WN.^nk;

Xk=x*WNnk;

MagX=abs(Xk) % Magnitude of calculated DFT

PhaseX=angle(Xk)*180/pi % Phase of the calculated DFT figure(1);

subplot(2,1,1);

plot(k,MagX);

subplot(2,1,2);

plot(k,PhaseX);

OUTPUT

Enter the the value of N(Value of N in N-Point DFT) 4

Enter the sequence for which DFT is to be calculated [1 2 3 4]

MagX = 10.0000 2.8284 2.0000 2.8284

PhaseX = 0 135.0000 -180.0000 -135.0000

DFT of the given sequence is

10.0000 -2.0000 + 2.0000i -2.0000  - 0.0000i -2.0000 -

2.0000i

Output:

RESULT:  The DFT of given sequence is obtained . Hence the theory and practical value are proved.

VIVA QUESTIONS:

? How to calculate output of DFT using MATLAB?

? Where DFT is used?

? What is the difference between DFT and IDFT?

? How to compute maximum length N for a circular convolution using DFT and IDFT.(what is command).

? Explain the function of twiddle factor?

? Give the practical application dft & idft?

? Explain the role of DFT & IDFT when the signal converted from the time domain to frequency domain?

? Differentiate between time variant and time invariant system. If x 1(n)={1,2,3,4} and x 2(n)={1,2,3}  Find the convolution using tabular representation.

? Draw all elementary standard discrete time signals.

? Differentiate between causal and Non causal system.

? If x 1(n)={1,2,3,4} and x 2(n)={5,6,7,8}  Find the circular representation for the above sequences.

? How can you compute Fourier transform form Z-transform ?

• Updated
Feb 03, 2020
• Views
5,278
You May Like