I want to find the corresponding blue and orange peak for the last oscillation.

조회 수: 2 (최근 30일)
Newbie
Newbie 2021년 9월 16일
댓글: Image Analyst 2021년 9월 16일
Hi there,
I have two signals oscillations and I want to find the corresponding blue and orange peak at the last oscillation. The code I am using gives me
the peaks from the start until the end however I only want the peaks that are corresponding in the last oscillation. Can anyone help please?
[pks3,locs3]=findpeaks(signal3,tt2,'MinPeakDistance',2*pi);
[pks4,locs4]=findpeaks(signal4,tt2,'MinPeakDistance',2*pi);

답변 (1개)

Star Strider
Star Strider 2021년 9월 16일
Probably:
[pks3,locs3]=findpeaks(signal3,tt2,'MinPeakDistance',2*pi);
[pks4,locs4]=findpeaks(signal4,tt2,'MinPeakDistance',2*pi);
LastBlue = [pks3(end) locs3(end)]
LastOrange = [pks4(end) locs4(end)]
You will need to experiment to see if those return the correct results.
  댓글 수: 3
Star Strider
Star Strider 2021년 9월 16일
My pleasure.
Add other name-value pairs, specifically 'MinPeakProminence' in order to further define the peaks to identify. I would start with 'MinPeakProminence',1 and then experiment to see what value returns the result you want. (Without the actual data to experiment with, I cannot suggest a specific value, or specific other name-value pair options.)
.
Image Analyst
Image Analyst 2021년 9월 16일
@Newbie, there are lots of options with findpeaks(). Star just mentioned one of them so look into that. Granted, some of them are hard to understand. One you might want tells you how close the peaks can be to each other horizontally. Since you have a rough idea of the main peak spacing, you can set the 'MinPeakDistance' to be around 5 so it won't get a bunch of lesser peaks close by the main peak.
If you still have trouble, attach your data with the paperclip icon.

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

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by