-2

I read a sound in matlab.

[y,Fs]=audioread('sound_noisy.wav');
magnitude=abs((fft(y)));

Now, how can i plot this magnitude from 0 to Fs/2 in matlab?

z.gomar
  • 372
  • 2
  • 11
  • 1
    Did you read the documentation for the `plot` function? What is the difficulty? – Cris Luengo Jun 01 '18 at 06:01
  • @CrisLuengo, I want to know how can i plot signal in frequency domain. – z.gomar Jun 01 '18 at 08:15
  • If you want to plot `magnitude` just say `plot(magnitude)`. If you want to know what the x-axis values are, that is answered here: https://stackoverflow.com/q/4364823/7328782 or for MATLAB syntax: https://stackoverflow.com/q/41240420/7328782 – Cris Luengo Jun 01 '18 at 14:15
  • Possible duplicate of [How do I obtain the frequencies of each value in an FFT?](https://stackoverflow.com/questions/4364823/how-do-i-obtain-the-frequencies-of-each-value-in-an-fft) – Cris Luengo Jun 01 '18 at 14:15

1 Answers1

0
f = linspace(0, Fs/2, length(magnitude)/2)
plot(f, magnitude(1:half))
fstop_22
  • 971
  • 5
  • 9