vertical error bar in loglog plot
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi
I am looking for a way to include error bars (vertical) in my plot from the codes that I am having now.
x=[20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37];
e=[2100 1750 1400 1150 1100 1000 760 620 570 500 450 420 320 310 290 210 220 170];
loglog(x,e,'bo');
hold on
Const1 = polyfit(log(x),log(e), 1);
m1 = Const1(1); k1 = Const1(2);
A = x.^m1.*exp(k1);
loglog(x, A,'k--');
xlim([10 40]);
grid on
Thanks a lot for your kind help!
댓글 수: 0
채택된 답변
dpb
2019년 6월 22일
편집: dpb
2019년 6월 22일
hEB=errorbar(x,A,err);
hAx=gca;
hAx.XScale='log';
hAx.YScale='log';
You'll have to have defined the error magnitude array, err, of course.
댓글 수: 4
dpb
2019년 6월 23일
That alone should make no difference--the ehat values above are the same as your A array to machine rounding accounting for the difference in computational sequence between the two expressions.
It looks like you now did pass err as the fitting residual on a point basis whereas the previous plot looked more like you had subtracted the residual from the value and used that (altho that didn't reproduce your figure exactly, it was much more similar, so not sure just exactly what you had done).
What you might really be wanting, however, is the RMS error of the overall fit, or a prediction error for the mean or an individual prediction...but, that's entirely up to you depending upon what error it is that you're interested in and for what purpose.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

