How to find largest Peak Values of signal and Save X,Y Values in MATLAB

3 ビュー (過去 30 日間)
Hammad Younas
Hammad Younas 2023 年 2 月 21 日
コメント済み: Rik 2023 年 2 月 21 日
Hello, I have the following Dataset in which first column shows the X-axis and 2nd Column shows the Y-axis.
I want to find Peak Value as shown in the image below and
Save the X and Y axis Values Corresponding Peak. Y axis Values as Amplitude and X axis values as Time
After that I want to subtract 2nd peak from 1st peak, and 4th peak from 3rd Peak.
It should be general for example if i got 6 peaks then 2nd subtract from 1st then 4th from 3rd and 6th from 5th
How can i do that in MATLAB
  2 件のコメント
Image Analyst
Image Analyst 2023 年 2 月 21 日
I imagine the message body also got changed.
Rik
Rik 2023 年 2 月 21 日
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2023 年 2 月 21 日
Read about the function max, findpeaks.
The above functions gives you index of the max value, using this index you can get x-value as well.
  2 件のコメント
Jan
Jan 2023 年 2 月 21 日
編集済み: Jan 2023 年 2 月 21 日
@Hammad Younas: The question contains only a vague description of what the input is. I guess it is a matrix? If you provide a small example (small enough to be posted here without stress, large enough to reproduce a result), the reader can use it to suggest working code. But it is inefficient, if the readers spend time to invent some input data.
Currently KSSV's answer hits the point already. I'd append: After letting findpeaks determine the peaks, use: result = x(1:2:end) - x(2:2:end), to get the differences.
Please do not address specific persons by using the @-method. Remember that they get a hint, that you try to catch their attention. Imagine what will happen, if all users do so: The active members get a pile of messages and reading them reduces their time to answer questions. If all asking users push their questions in this way, the quality of the forum will suffer. Thanks for caring about this suggestion.
Rik
Rik 2023 年 2 月 21 日
Deleted comment:
Approximately at 21 Feb 2023 08:02:28 GMT
@KSSV it does not work Sir.

サインインしてコメントする。


Sam Chak
Sam Chak 2023 年 2 月 21 日
If you are referring 'e' as the exponential function, and so on, then try this:
e1 = exp(1)
e1 = 2.7183
e2 = exp(2)
e2 = 7.3891
e3 = exp(3)
e3 = 20.0855

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by