I have some beginner, basic Physionet data I am trying to apply FFT to, but I'm a bit confused by the results I'm getting and don't think they're correct. I'm mostly using code from this example and from the fftshift documentation page with some tweaks but I'm not too sure what's wrong with my code or results. I have attached my code and snapshots of the results I'm getting.
load aami3am.mat
Fs = 720; % Sampling frequency
T = 1/Fs; % Sample time
L = 60000; % Length of signal
t = (0:L-1)*T; % Time vector
plot(t(1:43081),val(1:43081))
title('aami4b_h Signal')
xlabel('Seconds')
ylabel('ECG Amplitude')
NFFT = 2^nextpow2(L);
val = detrend(val);
Y = fft(val,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
plot(f,2*abs(Y(1:NFFT/2+1)))
title('FFT')
yY = fftshift(Y);
fshift = (-L/2:L/2-1)*(Fs/L);
powershift = abs(yY).^2/L;
plot(fshift(1:L),powershift(1:L))
title('FFT Shifted')
I'm using 43081 because there are 43081 values in the .mat file over the 60 seconds of data.