Question

How to use matlab implementate Discrete Fourier Transform with 2 inputs (signal and sample frequency), and...

How to use matlab implementate Discrete Fourier Transform with 2 inputs (signal and sample frequency), and output a vector. please use for loop to do this

0 0
Add a comment Improve this question Transcribed image text
Answer #1

DFT using for loop and output is present in Y1

function [Y] = DFT(x)

%calculating length of x

L_x = length(x);

NDFT = 2^nextpow2(L_x);

X1 =[x zeros(1,NDFT-L_x)];

Y1 = zeros(1,NDFT);

for k = 0:NDFT-1

Y(1k+1) = 0;

for n = 0:NDFT-1

Y1(k+1)=Y1(k+1)+(X1(n+1)*exp((-1j)*2*pi*k*n/L_x));

end

end

end

Above x is combined input of signal and sample frequency

s = 0:1/100:10-1/100;                     
x = sin(2*pi*15*s) + sin(2*pi*40*s); 

DFT(x)

Add a comment
Know the answer?
Add Answer to:
How to use matlab implementate Discrete Fourier Transform with 2 inputs (signal and sample frequency), 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