所以我有一个心电图信号,我必须从中只挑出一个周期并找到它的相位和幅度。到目前为止我有这个:
x1 = 3.5*ecg(2700);
y1 = sgolayfilt(kron(ones(1,13),x1),0,21);
n = (1:60000)'; %SOURCE OF THE PROBLEM. CANT FIND CORRECT N value to plug
mhb = y1(n);
ts = 0.00025;
t = [ts: ts: 7.5];
%plot (t, mhb)
%axis([2.95 3.626 -3 3.3]) %for one of the periods (cheat method) but its ok
f = [-(3*n/2):1:(3*n/2)-1]*(1/(3*ts*n));
f = [-(3*n/2):1:(3*n/2)-1]*(1/(3*ts*n));
Xf = fft(mhb);
subplot(211), plot(t, fftshift(abs(Xf))),axis([2.95 3.626 0 115]), grid
subplot(212), plot(t, fftshift(angle(Xf))), axis([2.95 3.626 -3 4]), grid
问题在于,对于该信号,以Hz为单位的频率由下式定义:f = [ - (3 * n / 2):1:(3 * n / 2)-1] *(1 /(3 * TS * N));并试图让n值适当,所以它的剂量超过矩阵值似乎是不可能的。唯一的提示是,如果N是30000,那么在fft之前添加2N额外的零(不太确定这意味着什么)。然而,它是引起问题的n值。谁能想到这一点,我将永远感激他/她。
P.S。我试过做30000 +加2(4个零)=溢出和计算机崩溃。不要那样做:P