add contraints on parameters defined in function

조회 수: 17 (최근 30일)
Giru Mishra
Giru Mishra 2018년 1월 19일
댓글: Matt J 2018년 1월 20일
I have a function:
y =x.^a + z.^b
For which I wrote a separate function as I neet to fit it over my data. But I want to add constraint: a>b. How will I do that? Please help me with it. Thanks
  댓글 수: 5
Torsten
Torsten 2018년 1월 19일
Use "lsqcurvefit" together with the model function y=Const*(x^(c1+c2)+z^c1) and include the bound constraint c2>0.
Once lsqcurvefit has determined c1 and c2, a=c1+c2 and b=c1 in your original model.
Best wishes
Torsten.
Giru Mishra
Giru Mishra 2018년 1월 19일
any other way?

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 19일
if a > b
y = x.^a + z.^b;
else
y = zeros(size(x));
end
  댓글 수: 4
Giru Mishra
Giru Mishra 2018년 1월 20일
Thanks Walter and Torsten... It was really very helpful..
Matt J
Matt J 2018년 1월 20일
@Giru,
You should Accept-click the answer if it helped you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by