How to write anonymous funtion to solve with lsqnonlin

조회 수: 1 (최근 30일)
Kothapelli Chandar
Kothapelli Chandar 2015년 12월 10일
댓글: Torsten 2015년 12월 11일
f(x) = f1(x)^2+f2(x)^2+...+fn(x)^2 + lambda*norm(x)

채택된 답변

Torsten
Torsten 2015년 12월 10일
function F = myfun(x)
F(1) = f1(x);
F(2) = f2(x);
...
F(n) = fn(x);
The constant L can be omitted since it does not influence the optimal x.
Best wishes
Torsten.
  댓글 수: 2
Kothapelli Chandar
Kothapelli Chandar 2015년 12월 10일
Hi Torsten, thank you for the answer. if the term is not a constant and a dependent on x ?
Torsten
Torsten 2015년 12월 11일
Then use an (n+1)-th function f_(n+1)(x)=sqrt(L) if L is positive.
Best wishes
Torsten.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by