How can i plot the magnitude and phase response my output signal?
Show older comments
Hi,
How can I plot the magnitude and phase response of y[n] that i have obtained? y[n] = [-3 8 5 2]
Here's my code:
Trial>> t = 0:1/100:10-1/100;
Trial>> x = [-3 8 5 2]
Trial>> y = fft(x);
Trial>> m = abs(y);
Trial>> f = (0:length(y)-1)*100/length(y);
Trial>> subplot(2,1,1)
Trial>> plot(f,m)
Trial>> title('Magnitude')
Thank you
3 Comments
Aditya Desai
on 23 Feb 2016
What is x here? If it is the signal, then should it not be the same size as t?
DJrocker
on 24 Feb 2016
Geoff Hayes
on 24 Feb 2016
t is the array of sample times which is the first variable that you define above (but never use thereafter). Why does your x only have four samples?
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!