fitting a curve to data

1 view (last 30 days)
blitz
blitz on 6 Oct 2014
Edited: blitz on 7 Oct 2014
Can anyone tell me what mistake I am making here? Can you please suggest any changes which make this code work? Thank you.

Accepted Answer

Star Strider
Star Strider on 6 Oct 2014
Objective functions for lsqcurvefit and nlinfit have to have the parameter argument as the first argument and the dependent variable as the second argument.
This should work:
fun = @(x,xdata) x(1).*sin((x(2).*xdata)+x(3)); %function handle for approx curve

More Answers (0)

Community Treasure Hunt

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

Start Hunting!