So i've got an exisiting ekg signal that I have to take get the fourier transform for, and plot the phase (angle) and magnitude. My code looks like this:
x1 = 3.5*ecg(2700);
y1 = sgolayfilt(kron(ones(1,13),x1),0,21);
n = (1:30000)';
del = round(2700*rand(1));
mhb = y1(n+del);
ts = 0.00025;
t = [ts: ts: 7.5];
%plot(t,mhb)
%xlabel('Time(sec)')
%ylabel('Amp'); grid on
Xf = fft(mhb(t));
w = [-(n/2):1:(n/2)-1]*(1/(ts*n));
w = [-(n/2):1:(n/2)-1]*(1/(ts*n));
subplot(211), plot(w, fftshift(abs(Xf))), grid
subplot(212), plot(w, fftshift(angle(Xf))), grid
It's telling me this error: "Subscript indices must either be real positive integers or logicals." I'm pretty sure thats correct, unless I'm doing something completely incorrect. Any help would be appreciated.