Findpeaks loop value not saving separately

조회 수: 1 (최근 30일)
Ramesh Bala
Ramesh Bala 2019년 6월 6일
댓글: LO 2019년 6월 10일
I'm using findpeaks and trying to save the AMP values separately.But my loop is saving only the last value even though it runs in a loop.So,instead of 2*101 value I,get the last value 1*101 ??
s=load ('36019.mat');
signal(1,1:length(s.ans))=s.ans;
s=load ('35772.mat');
signal(1,1:length(s.ans))=s.ans;
load t.mat
S = [1 2]
for k=1:1:length(S)
figure;
[PkAmp, PkTime] = findpeaks(signal(k,:),t);
end
  댓글 수: 1
Ramesh Bala
Ramesh Bala 2019년 6월 10일
Alright ! I found out that there is a difference in the matrix size and thus it possibly wont be grouped.
I would like to analyse the delay matrix between these and many points.how to do it?

댓글을 달려면 로그인하십시오.

채택된 답변

LO
LO 2019년 6월 10일
not sure what you want to do but I try to guess.
you can use the function "diff" between elements of different matrices (for comparing elements having the same index, you can use another for loop)
  댓글 수: 2
Ramesh Bala
Ramesh Bala 2019년 6월 10일
Thanks for the reply.
I'm trying to find the delay matrix between the signal points.In this case 35772.at and 36019.mat.
I don't know which one to use either crosscorr?
LO
LO 2019년 6월 10일
crosscorr will give you a general view on "all delays" possible, between your two signals (in the form of crosscorrelation indexes). Diff will give you the pairwise distances (differences between the actual signal values) between given points of the two signals. by default I think the function would calculate the difference between consecutive points in a single signal at a time (https://de.mathworks.com/help/matlab/ref/diff.html?searchHighlight=diff&s_tid=doc_srchtitle)
but you can use also a loop to compute pairwise comparisons of elements with the same index. another thing you could do is calculate the inter-element interval of each signal using diff and then compare the result of the two signals using the histogram function.
if you want to compare the two signals and all relative delays between all of their elements you have to use the crosscorrelation function, yes.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by