plot(abs(fft(ecg)))
I have also tried
fvtool(x_vals)
which gave me :
However I want the x axis in Hz. So essentially I want to see the frequency spectrum of this signal in Hz.
Thanks!
function [f amp] = getspectrum( Mdata, Mf )
% Mdata data
% Mf sampling rate / frequency (Hz)
NFFT = 2 ^ nextpow2(length(Mdata));
Y = fft(double(Mdata), NFFT) / length(Mdata);
f = (double(Mf) / 2 * linspace(0, 1, NFFT / 2))'; % Vector containing frequencies in Hz
amp = 2 * abs(Y(1:(NFFT / 2))); % Vector containing corresponding amplitudes
I hope this might be of help.