How can I flip the top area of the peak that is going down?

1 回表示 (過去 30 日間)
Lizan
Lizan 2015 年 5 月 5 日
コメント済み: Image Analyst 2015 年 5 月 5 日
Hi, I would like to flip the part of the peak that goes gown so its pointed upward. I want there to be a space between the data where the top-points are to mark that this was the end-points and that the top peak goes upward instead of downward.. how can you do this?

回答 (1 件)

Image Analyst
Image Analyst 2015 年 5 月 5 日
For one such section, this should work (untested):
peakValue = max(signal);
index1 = find(signal > (peakValue - 0.001), 1, 'first')
index2 = find(signal > (peakValue - 0.001), 1, 'last');
signal(index1:index2) = 2 * peakValue - signal(index1:index2);
  2 件のコメント
Lizan
Lizan 2015 年 5 月 5 日
編集済み: Lizan 2015 年 5 月 5 日
Can you comment on what you are doing in this line:
2 * peakValue - signal(index1:index2)
Image Analyst
Image Analyst 2015 年 5 月 5 日
It's basically finding the distance between the max (top of the box) and the signal below the top of the box. Maybe if I did it more explicitly like this
delta = abs(peakValue - signal)
% Now add the delta to a vertical offset of peakValue
newSignal = peakValue + delta
but if you do the math you get
newSignal = peakValue + peakValue - signal
newSignal = 2 * peakValue - signal
So that's how I got the formula.

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

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by