How I have all three error bars in one figure

1 次查看(过去 30 天)
R1=10
R2=27
R3=10
Rtotalseries=R1+R2+R3
Vs=5
Itotal=Vs./Rtotalseries
V1=(Vs./Rtotalseries).*R1
V2=(Vs./Rtotalseries).*R2
V3=(Vs./Rtotalseries).*R3
V1measured=1.058
V2measured=2.875
V3measured=1.063
V1percenterror=((abs(V1-V1measured)./V1))*100
V2percenterror=((abs(V2-V2measured)./V2))*100
V3percenterror=((abs(V3-V3measured)./V3))*100
errorbar(V1,V1measured,V1percenterror)
errorbar(V2,V2measured,V2percenterror)
errorbar(V3,V3measured,V3percenterror)
=> I'm trying to get all three error bar codes in a single plot figure

回答(2 个)

Star Strider
Star Strider 2024-1-29
One opotion is to use the hold function (and also figure) —
R1=10
R1 = 10
R2=27
R2 = 27
R3=10
R3 = 10
Rtotalseries=R1+R2+R3
Rtotalseries = 47
Vs=5
Vs = 5
Itotal=Vs./Rtotalseries
Itotal = 0.1064
V1=(Vs./Rtotalseries).*R1
V1 = 1.0638
V2=(Vs./Rtotalseries).*R2
V2 = 2.8723
V3=(Vs./Rtotalseries).*R3
V3 = 1.0638
V1measured=1.058
V1measured = 1.0580
V2measured=2.875
V2measured = 2.8750
V3measured=1.063
V3measured = 1.0630
V1percenterror=((abs(V1-V1measured)./V1))*100
V1percenterror = 0.5480
V2percenterror=((abs(V2-V2measured)./V2))*100
V2percenterror = 0.0926
V3percenterror=((abs(V3-V3measured)./V3))*100
V3percenterror = 0.0780
figure
hold on
errorbar(V1,V1measured,V1percenterror)
errorbar(V2,V2measured,V2percenterror)
errorbar(V3,V3measured,V3percenterror)
hold off
Make appropriate changes to get the result you want.
.

Walter Roberson
Walter Roberson 2024-1-29
R1=10
R1 = 10
R2=27
R2 = 27
R3=10
R3 = 10
Rtotalseries=R1+R2+R3
Rtotalseries = 47
Vs=5
Vs = 5
Itotal=Vs./Rtotalseries
Itotal = 0.1064
V1=(Vs./Rtotalseries).*R1
V1 = 1.0638
V2=(Vs./Rtotalseries).*R2
V2 = 2.8723
V3=(Vs./Rtotalseries).*R3
V3 = 1.0638
V1measured=1.058
V1measured = 1.0580
V2measured=2.875
V2measured = 2.8750
V3measured=1.063
V3measured = 1.0630
V1percenterror=((abs(V1-V1measured)./V1))*100
V1percenterror = 0.5480
V2percenterror=((abs(V2-V2measured)./V2))*100
V2percenterror = 0.0926
V3percenterror=((abs(V3-V3measured)./V3))*100
V3percenterror = 0.0780
errorbar(V1,V1measured,V1percenterror)
hold on
errorbar(V2,V2measured,V2percenterror)
errorbar(V3,V3measured,V3percenterror)
hold off
The third error bar is so close to the first error bar that it is easy to confuse them.

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by