axis labels not working

1 visualizzazione (ultimi 30 giorni)
Allen Antony
Allen Antony il 29 Ott 2020
Commentato: Walter Roberson il 30 Ott 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))

Risposte (1)

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

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by