필터 지우기
필터 지우기

least square curve fitting

조회 수: 1 (최근 30일)
Vipin Mohan
Vipin Mohan 2014년 10월 8일
댓글: Vipin Mohan 2014년 10월 8일
Hi
Can anyone help me to do Curve fitting with Non-linear Least Square curve fitting.
I have few points w.r.t time.. and I have to make a SINE wave with these points.
Lets say following are the values (Even though its not similar to a sinusoidal values)
Time Current
04.500 11.452
04.525 11.528
04.550 11.586
04.575 11.623
04.600 11.640
04.625 11.638
04.650 11.620
04.675 11.592
04.700 11.559
I have to make a sinusoidal curve with the help of Non Linear Least square (x = lsqnonlin(fun,x0))... the sinusoidal function can be in the form , CurrentI= A+Sin(w*Time) (with a fixed frequency lets say 200Hz)..
I know the concept of Least sqr method, but the problem is , i am not getting how to make the above function 'fun'.
Thank you.

답변 (1개)

Stephen23
Stephen23 2014년 10월 8일
편집: Stephen23 2014년 10월 8일
fun is the function handle of the function you wish to fit to the data. It is your job to define a function of the curve you wish to fit, ensuring that it fulfills the requirements of lsqnonlin , which are explained in the documentation.
In particular, the function needs to accept an input vector, and provide an output vector which is the curve given those input values. The lsq function adjusts the input vector until the output vector best matches your given data.
You can also find explanations and examples here:
You might also like to consider using lsqcurvefit , as this "provides a convenient interface for data-fitting problems".
  댓글 수: 1
Vipin Mohan
Vipin Mohan 2014년 10월 8일
Thnkx for the reply..
As I told, i had read thru the explanations and all...but i dont know how can i put the function handle. can i put put simply as 'A+sin(w*t)' .. its a small doubt only.A similar program will also be helpful. That is what I am expecting.3 line program code will be great .!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by