lsqnonlin stops iteration with an error
Afficher commentaires plus anciens
hi, i have a problem with lsqnonlin. i want to fit experimental data to the solution of a differential equation via least square. lsqonline seems to work correctly, but then it stops and i have no idea why. hopefully you can give me a hint. Thats the error message:
4 20 0.291191 0.0338188 0.234 0
5 24 0.260773 0.0747579 0.284 0
??? Error using ==> snls at 390
The number of equations must be greater than n.
Error in ==> lsqncommon at 149
[xC,FVAL,LAMBDA,JACOB,EXITFLAG,OUTPUT,msgData]=...
Error in ==> lsqnonlin at 241
[xCurrent,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Error in ==> lsqZH at 32
[x_top, resnorm_top] = lsqnonlin(fun_top,x0,lb,ub, options);
My Code looks like this:
options = optimset('Display','iter');
fun_top=@(x)lsqFunctionZH(x, z_exp, r_exp);
lb = [-1.0, 0.01, 1.4];
ub = [-0.5, 1.0, s_top];
x0 = [-0.75, 0.1, 1.45];
[x_top, resnorm_top] = lsqnonlin(fun_top,x0,lb,ub, options);
In my fun_top.m i solve the differential equation and return the vector r_sol-r_exp. For some x, the equation cant be solved, so the function returns NaN. Is that a problem?
Thank you for your help.
1 commentaire
Andsalot
le 6 Nov 2016
Réponses (0)
Catégories
En savoir plus sur Structural Mechanics dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!