Hello everyone, i need your help :)
I have a function that returns a vector D and a vector of variables L. i want to minimise D starting from an initial vectror L0.
I am using "lsqnonlin". L=lsqnonlin(fun,L0,lb,ub).
it works perfectly, however i want D to be minimised to a certain value that i define. The bounds of the solver are set for L not D.
So my question is: how do i define the value of D to be minimised to?
i hope i was clear enough. i cant give the code since it is a very big one.
Thanks in advance :)

 채택된 답변

Steven Lord
Steven Lord 2016년 7월 7일

0 개 추천

"D to be minimised to a certain value" -- so you don't actually want to minimize your function but instead want to find a solution to the system of equations fun(x) = certain_value [or to write it another way, fun(x) - certain_value = 0? In that case, take a look at fsolve instead of lsqnonlin.

댓글 수: 2

Asma SEDDAOUI
Asma SEDDAOUI 2016년 7월 7일
it doesn't work because i also need bounds on L. i thought maybe in the options of the solver. is it a good approach?
Asma SEDDAOUI
Asma SEDDAOUI 2016년 7월 7일
oh i found it. it was very easy. still use lsqnonlin but the returned value is D=fun(x)-d0. d0 is the "certain value".
thank you very much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2016년 7월 7일

댓글:

2016년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by