How I have all three error bars in one figure

1 Ansicht (letzte 30 Tage)
SANGBIN LEE
SANGBIN LEE am 29 Jan. 2024
Beantwortet: Walter Roberson am 29 Jan. 2024
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

Antworten (2)

Star Strider
Star Strider am 29 Jan. 2024
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 am 29 Jan. 2024
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.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by