Smoothing only peaks in a Curve

1 次查看(过去 30 天)
Anirudh
Anirudh 2014-2-21
评论: Anirudh 2014-3-31
Hello,
The curve I have is shown in the image. Is there a way I could smooth only the peak, which is around the X=800 mark, ideally keeping the rest of the data as the raw signals.
In case I decide to join a raw and a smoothed curve (using a filter), the problem then I face is the joining point of the raw curve and the smoothed curve, which shows a step (undesired).
I would like to ideally keep the raw data till X=720 (point where constant rise starts), then continue with the raw data through the constant slope, i.e from x=720 to the point where smoothing of the peak starts, perform a smoothing with a factor and rejoin back with the raw data once the smoothing is done (keeping that step in mind again).
I was talking to one of the correspondents and it was nice of him to help me out on this thread, http://www.mathworks.com/matlabcentral/answers/116391-smoothing-only-a-part-of-a-curve#answer_124995 but I'm kinda needing an urgent answer, and if possible today.
Could anyone out there help me out on this one?
Regards,
Anirudh

回答(2 个)

Nitin
Nitin 2014-2-22
Did you check the smooth function?

Image Analyst
Image Analyst 2014-2-22
Just smooth the whole thing, say with conv() to do a sliding average or with sgolay to so a sliding polynomial Savitzky-Golay filter. Then replace the original pixels with the smoothed one in the range you want
smoothedSignal = conv(originalSignal, ones(1,9), 'same'); % or whatever
newSignal = originalSignal; % Initialize
% Replace region of interest with smoothed values.
newSignal(index1:index2) = smoothedSignal(index1:index2); % You determine the indexes in some way.
  4 个评论
Image Analyst
Image Analyst 2014-2-28
Anirudh, what's the status of this? Are we done? Do you need a more comprehensive demo? Did I answer your question?
Anirudh
Anirudh 2014-3-31
Image Analyst, Thanks for writing back :).
I used the conv() function, smoothed the curve and replaced only a certain smoothed part (say X=750 to X=820), in the raw signals. I then smoothed this entire curve once again to eliminate the steps at X=750 and X=820.
But this is not a very convincing method as I'm deviating from the original values by more, so I'm still on the lookout for a better solution to this.
Thanks, Anirudh

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by