Filter löschen
Filter löschen

nonlinear least square optimization

1 Ansicht (letzte 30 Tage)
Az.Sa
Az.Sa am 10 Jan. 2023
Beantwortet: Star Strider am 10 Jan. 2023
Where,
and known
I want to solve this problem by using a nonlinear least square optimization . This is the code I tried to use but I am receiving an error
fun = @(x) sum( ( A.'*x + B.'*x - (C.'*x) -b ).^2 ); % A is X_k coeffecients , B is Y_k coefficents , C is Y_k squared coefficents , b is b_k ^2
Aeq = ones(1,5);
lb = zeros(1,5);
x0 = ones(1,5)/5;
x = lsqnonlin(fun,x0,lb)
Any adivce to improve my code are appreciated.

Antworten (1)

Star Strider
Star Strider am 10 Jan. 2023
The Symbolic Math Toolbox is not appropriate for this. Use the Optimization Toolbox function lsqcurvefit instead (since you apprarently want to bound the parameters). If you have defined the function symbolically, use the matlabFunction function to convert it to an anonymous function you can use with lsqcurvefit. See especially the documentation section on Vars since that will allow you to define the order of the arguments and the parameter vector so that it will work correctly with the optimisation functions.

Kategorien

Mehr zu Nonlinear Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by