axis labels not working

1 Ansicht (letzte 30 Tage)
Allen Antony
Allen Antony am 29 Okt. 2020
Kommentiert: Walter Roberson am 30 Okt. 2020
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))

Antworten (1)

Walter Roberson
Walter Roberson am 30 Okt. 2020
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 Kommentare
Allen Antony
Allen Antony am 30 Okt. 2020
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 am 30 Okt. 2020
The code is identifying the correct trough for me with the test data I created. Can you attach your data for testing?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by