필터 지우기
필터 지우기

How to set a parameter lower bound during curve fitting?

조회 수: 56 (최근 30일)
Alexandria Will-Cole
Alexandria Will-Cole 2018년 7월 25일
댓글: Alexandria Will-Cole 2018년 7월 25일
Hello, I want to set the lower bound for my p2 variable as 0, because a negative value is unphysical for my data set.
Here is my code:
rho=Resistivityohmcm; T=TemperatureK;
plot(T,rho,'-o')
x=T; y=rho;
fnPolySq=@(p1,p2,x) p1*x.^2 + p2; %fit(x,y,fnPolySq) mask = x > 135 ; %restricts the data fit to before the upturn
f = fit(x(mask), y(mask), fnPolySq ); plot(f, T, rho)
plot(f,T,rho) disp (f)
Thanks!

채택된 답변

Adam Danz
Adam Danz 2018년 7월 25일
편집: Adam Danz 2018년 7월 25일
Here's how you set bounds using fit()
See 'Lower'.
  댓글 수: 3
Adam Danz
Adam Danz 2018년 7월 25일
In the line of code you shared, I don't see where you've implemented the 'Lower' parameter. See the link again and read the section, " 'Lower' — Lower bounds on coefficients to be fitted"

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

추가 답변 (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