Question
Need help with coding in MATLAB for communication
1. Use DFT to find the magnitude and phase spectra of the periodic triangular pulses where has a peak value of 3 at. It is sy
0 0
Add a comment Improve this question Transcribed image text
Answer #1

TO FIND DFT & IDFT OF A GIVEN SIGNAL USING INBUILT MATLAB FUNCTION:

clc

clear all

close all

x=input('enter the sequence of x')

N=input('length of dft N=')

disp('N-point DFT')

X=fft(x)

n=0:1:length(X)-1

subplot(2,2,1)

stem(n,x)

xlabel('time')

ylabel('amplitude')

title('input sequence')

subplot(2,2,2)

stem(n,abs(X))

xlabel('frequency')

ylabel('amplitude')

title('magnitude spectrum of x[n]')

subplot(2,2,3)

stem(n,angle(X))

xlabel('frequency')

ylabel('phase')

title('phase spectrum of x[n]')

%inverse DFT

disp('N-point IDFT')

xr= ifft(X)

subplot(2,2,4)

stem(n,xr)

xlabel('time')

ylabel('amplitude')

title('IDFT')

THIS IS THE CODE FOR ANY SEQUENCE

if u wanna plot for triangular pulse

use syms

code:

syms x

fplot(triangularPulse(x,[-a a]))

SAMPLE INPUTS:

X = [ [2,3,-8,-6,4,1,-9]]

Xr= [2.000000000000000,3,-8,-6,4,1,-9]

N-point DFT

X =

  Columns 1 through 5

-13.0000 + 0.0000i   1.6186 + 3.7312i   8.3949 -23.4224i   3.4864 - 2.4938i   3.4864 + 2.4938i

Columns 6 through 7

   8.3949 +23.4224i   1.6186 - 3.7312i

Add a comment
Know the answer?
Add Answer to:
Need help with coding in MATLAB for communication 1. Use DFT to find the magnitude and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT