axis labels not working

1 次查看(过去 30 天)
Allen Antony
Allen Antony 2020-10-29
Basically I was trying to do a while loop to find the s point of a qrs signal that has already filtered. I tried to use the statement provided below to find the S component, however it gave me the error that,." Index exceeds the number of array elements (1)". Was hoping someone could tell me what was wrong with while loop.
Thanks
%Simplied Version of previous stuff
ECG_Raw=Orig_Sig;
t=length(ECG_Raw);
[AmpRC,TimeRC]=findpeaks(Orig_Sig,'MinPeakDistance',120,'MinPeakHeight',150);
TimeR=TimeRC';
% While loop statement which I am having problems with
current=TimeR(1);
next=current+1;
while Orig_Sig(current)>=Orig_Sig(next)
current=next;
next=next+1;
end
plot(t(current),Orig_Sig(current))

回答(1 个)

Walter Roberson
Walter Roberson 2020-10-30
Suppose there is only one peak detected, and that everything from there on is non-increasing.
*
/ \
\
----
and the position of the * is returned. Then for each point from there on, the signal value at the "current" point is >= the signal value of the "next" point. So as you move forward looking for an increase back, you run off the end of the array.
Now, that is a general problem with your algorithm. However you also have the much more specific problem that for some reason your Orig_Sig is only a single sample long.
  2 个评论
Allen Antony
Allen Antony 2020-10-30
I realised what the problem was with the code. The plot was meant to be
plot(current,ECG_Raw(current),'o')
However I now have another problem, the output from the loop itself is not what i want.
Walter Roberson
Walter Roberson 2020-10-30
The code is identifying the correct trough for me with the test data I created. Can you attach your data for testing?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by