getting started with parameter estimation using lsqnonlin

8 views (last 30 days)
Hi. I am new to parameter estimation and modeling. I am going through the tutorials on the website and trying to use them for my own application now.
I made a function that looks like this and want to use lsqnonlin fit to identify the values of k.
function fitfunc(kinit)
t = [0 10 30 60 90 120 180 420];
k = zeros(1,length(t));
ra = zeros(1,length(t));
k(1) = kinit;
ra(1) = 0;
for i=2:length(t)
ra(i) = k(i-1) + ((k(i) - k(i-1))/(t(i)-t(i-1))) * (t(i) - t(i-1));
end
end
I used the optimization tool and specified the solver and used the trust region algorithm. I specified a function handle and a start point (0).
When I run this, I see:
Optimization running.
Objective function value: 0.0
Initial point is a local minimum.
Optimization completed because the size of the gradient at the initial point
is less than the selected value of the optimality tolerance.
I am likely making a lot of beginner mistakes - any guidance is appreciated.

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!