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.
No products are associated with this question.
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));
Play games and win prizes!Learn more