nonlinear least square optimization

1 回表示 (過去 30 日間)
Az.Sa
Az.Sa 2023 年 1 月 10 日
回答済み: Star Strider 2023 年 1 月 10 日
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.

回答 (1 件)

Star Strider
Star Strider 2023 年 1 月 10 日
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.

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by