nonlinear least square optimization
조회 수: 3 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!