フィルターのクリア

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 Center および File ExchangeSolver 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