1

所以我有一个心电图信号,我必须从中挑出一个周期并找到它的相位和幅度。到目前为止我有这个:

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 值。谁能想到这一点,我将永远感激他/她。

Ps 我试过做 30000 + 添加 2(4 个零)= 溢出和计算机崩溃。不要做那个选项:P

4

0 回答 0