MATLAB: Wrong FFT for an audio file

audiofft

I want to sketch the power spectrum of an audio file but i get wrong answer.human speech should be in range of 50 to 300 hz
[x Fs] = audioread('v0.mp3');
nf=length(x);
Y = fft(x,nf);
Y = Y-mean(Y);
f = Fs/2*linspace(0,1,nf/2+1);
plot(f,abs(Y(1:nf/2+1)));
i should get this:
Screen Shot 2020-01-22 at 2.26.05 AM.png
but instead i get this:
Screen Shot 2020-01-22 at 2.26.39 AM.png

Best Answer

The plot is correct. You are not considering the exponential multiplication at the right end of the frequency axis.
This makes it a bit more obvious:
[x Fs] = audioread('Amirhosein Khanlari v0.mp3');
nf=size(x,1);
Y = fft(x-mean(x))/nf;
f = Fs/2*linspace(0,1,fix(nf/2)+1);
figure
plot(f,abs(Y(1:nf/2+1))*2)
xlim([0 1.5E+4])
set(gca, 'XTick', (0:2500:15000))
producing:
1Wrong FFT for an audio file - 2020 01 21.png