How to limit data from a fit?
조회 수: 24 (최근 30일)
이전 댓글 표시
I have a custom fit that fits data that I've plotted. I now want to try to limit the range in which the fit occurs. I want it to limit where x is less than 150.
Here is my current 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)
plot(f,T,rho)
disp (f)
댓글 수: 0
채택된 답변
Walter Roberson
2018년 7월 24일
mask = x < 150;
f = fit(x(mask), y(mask), fnPolySq);
plot(f, T, rho)
댓글 수: 0
추가 답변 (1개)
Aquatris
2018년 7월 24일
Create new variables;
range = find(x<150);
xNew = x(range)
yNew = y(range)
Obtain your fit using xNew and yNew variables instead of x and y.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!