code to obtain better curves

3 views (last 30 days)
joo
joo on 25 Sep 2012
I am new with matlab and i am having this following problem. i have a little noise on my plots.
I need to smooth the curves. could you please tell me what i should do to achieve that. i was thinking in applying some filter but i don't really know if it is the appropriate thing to do in matlab, and if so what kind of filter to use. I would be very grateful if you could help me also with some code. i need an automatic way to do this since i have kind of 60 plots i need to solve this type of problem using matlab, and i am new with this software.
thank you so so much guys!
  3 Comments
Jan
Jan on 25 Sep 2012
When I click on the PHP link you have posted, I get an error=8 message and I'm asked to login. I will not sign in an internet service only to see a picture for a question. Please send a mail to MathWorks and ask for the possibility to host picture directly. You find the mail address on the bottom of this page. I hope that this feature is implemented, when 1000 users ask for it.
Ryan
Ryan on 25 Sep 2012
Do you have the curve fitting toolbox? If so, type help smooth in the Matlab command line. Else you'll need to use help filter.

Sign in to comment.

Accepted Answer

Jan
Jan on 25 Sep 2012
Filtering is destructive. Therefore for a serious scientific work it is obligatory to find out the physical source of the noise such that the filter parameters can be motivated. Choosing paramters until the data look "nice" have caused too many bad publications. E.g. when a signal is expected at 493.7MHz, you can filter away everything lower than 492MHz and higher than 494MHz. What a surprise that afterwards a strong peak can be found near to the expected value...
But if you know, that the 50Hz noise of the power supply is responsible, a matching filter can be applied securely - but even then the filter order and bandwidth will produce different results. Therefore filtering demands for some eductaion in signal processing.

More Answers (1)

Kevin Claytor
Kevin Claytor on 25 Sep 2012
If you have the curve-fitting toolbox, smooth might be a good place to start; http://www.mathworks.com/help/curvefit/smooth.html
There is also the built-in filter function; http://www.mathworks.com/help/matlab/ref/filter.html. Here you have to design the filter; as per their example, you can do simple N point averaging with the filter function "ones(1,N)/N".

Community Treasure Hunt

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

Start Hunting!