필터 지우기
필터 지우기

Is there a built in function like MinPeakHeight but for maximum numbers?

조회 수: 6 (최근 30일)
Heirleking
Heirleking 2022년 3월 18일
답변: Star Strider 2022년 3월 18일
It would be something like MaxPeakHeight to find negative peaks. I have a random signal with positive and negative values and need to find negative peaks.

답변 (3개)

Walter Roberson
Walter Roberson 2022년 3월 18일
Work with the negative of the signal; the most negative original signal would become the most positive on the transformed signal.
  댓글 수: 1
Heirleking
Heirleking 2022년 3월 18일
That would be true if all the positive vales were the same as the negative… not in my case, tho

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


Image Analyst
Image Analyst 2022년 3월 18일
Walter is right. You just didn't understand. Here is some code to explain it. You can do
% Find peaks.
[peakValues, indexesOfPeaks] = findpeaks(signal); % Add options if you want.
% Find valleys. They will be peaks of the inverted signal.
[valleyValues, indexesOfValleys] = findpeaks(-signal); % Add options if you want.
% Now invert the values to make them upside down again.
valleyValues = -valleyValues;
Note it doesn't matter if your signal is all positive, all negative, or even crosses the y=0 axis so that it has both positive and negative values. The code above will work. There are some options (granted most of them are confusing) that can help you narrow down the peaks and valleys to just the ones you want.
  댓글 수: 2
Image Analyst
Image Analyst 2022년 3월 18일
And I deleted your tags because this has nothing to do with compiling or the Coder product since you're not talking about building a standalone executable, or embedding your code into hardware (actual silicon on a standalone integrated circuit chip). So no embedding into silicon, no code generation, no compiling, etc. It's just a straightforward MATLAB program.
Heirleking
Heirleking 2022년 3월 18일
Oh I see, I did not understand Walter's response. Thank you so much!

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


Star Strider
Star Strider 2022년 3월 18일
Another option is the islocalmin function (introduced in R2017b).

카테고리

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