Clear Filters
Clear Filters

How can I add error bars on a scatter plot using the calculated errors?

2 views (last 30 days)
I want to add error bars to this graph: (SEM is the standard error mean for Dt, and I want to add error bars only onto Dt in the graph)
dfs= [ 0 4.5000 9.0000 13.5000 18.0000 22.5000 27.0000 31.5000]
Dt= [ 4.1681 4.1719 3.8631 4.1915 3.2843 3.2850 3.2308 3.2795]
R= [ 6.2272 7.4491 8.4765 7.7533 9.3598 12.9844 13.9740 9.2937]
f(1)=figure; plot (dfs.',Dt,'ro',dfs.',R,'bo');
SEM = [ 0.0142 0.0142 0.0127 0.0164 0.0183 0.0224 0.0193 0.0232];
Thanks!

Accepted Answer

Star Strider
Star Strider on 18 Jul 2014
The SEM values are sufficiently small that they appear as small horizontal bars. This plots both of your data series, with the error bars only plotted for Dt:
figure(1)
errorbar(dfs, Dt, SEM, 'ro')
hold on
plot(dfs,R,'bo')
hold off

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!