random equation fitting to data set and finding constant parameters

2 ビュー (過去 30 日間)
aditi
aditi 2014 年 1 月 22 日
コメント済み: Walter Roberson 2017 年 10 月 21 日
I have x and y coordinates and I want to fit an equation:
y=a*exp(x^b - 2^b)
to the data set and thus finding parameters a and b. Please help me through it.

採用された回答

Amit
Amit 2014 年 1 月 22 日
First make a function that you'll use to fit like this:
function val = myfunc(par_fit,x,y)
% par_fit = [a b]
val = norm(y - par_fit(1)*exp(x.^2-2^par_fit(2)));
Now, find the parameters like:
my_par = fminsearch(@(par_fit) myfunc(par_fit,x,y),rand(1,2));
  35 件のコメント
aditi
aditi 2014 年 1 月 23 日
okay...i will follow previous instructions carefully...maybe i have done something wrong...
and a big thanks to u amit...u were of great help :) will contact u if m stuck again somewher else thanks
aditi
aditi 2014 年 1 月 23 日
one more thing...what i found after googling is that in such cases u have to give a specific range for 1 of the parameter... so any idea about that..??
like in above equation if i deliberately want that the b value should lie betweem 0.2 and 2 and then find a and b...how can i do that???

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2014 年 1 月 22 日
You might also try FMINSPLEAS. It can take advantage of the fact that y has a linear dependence on one of the parameters 'a'.
  8 件のコメント
Sneha Roy
Sneha Roy 2017 年 10 月 21 日
編集済み: Sneha Roy 2017 年 10 月 21 日
for some reason the variable par_fit is undefined error doesn't go away. How did you solve that error?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by