nonlinear least square optimization

1 visualización (últimos 30 días)
Az.Sa
Az.Sa el 10 de En. de 2023
Respondida: Star Strider el 10 de En. de 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.

Respuestas (1)

Star Strider
Star Strider el 10 de En. de 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.

Categorías

Más información sobre Nonlinear Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by