Smoothing only peaks in a Curve

10 views (last 30 days)
Anirudh
Anirudh on 21 Feb 2014
Commented: Anirudh on 31 Mar 2014
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

Answers (2)

Nitin
Nitin on 22 Feb 2014
Did you check the smooth function?

Image Analyst
Image Analyst on 22 Feb 2014
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 Comments
Image Analyst
Image Analyst on 28 Feb 2014
Anirudh, what's the status of this? Are we done? Do you need a more comprehensive demo? Did I answer your question?
Anirudh
Anirudh on 31 Mar 2014
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!