Plot error bars in curve fitting figure
조회 수: 13 (최근 30일)
이전 댓글 표시
Hi I would like to know how to add error bars to the figure of the curve fitter.
댓글 수: 0
답변 (1개)
Star Strider
2022년 11월 21일
x = 0:20;
y = 1-exp(-0.25*x) + randn(size(x))*0.1;
objfcn = @(b,x) b(1) - exp(b(2).*x) + b(3);
mdl = fitnlm(x(:),y(:), objfcn, rand(3,1))
[yf,yci] = predict(mdl, x(:));
figure
plot(x, y, '.:')
hold on
errorbar(x, yf, yci(:,1)-yf, yci(:,2)-yf)
hold off
grid
xlim([-1 21])
A similar approach would likely work with the Curve Fitting Toolbox functions.
It will be necessary for you to experiment with those in your project.
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!