i am trying to add a legend for the 0.2% offset line onto the graph, but when i run this, the previous three legend just disappear.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
kaixi gu
am 11 Sep. 2022
Beantwortet: Alan Stevens
am 11 Sep. 2022
%plot with errorbar
plot(strain,stress)
hold on
title('strain vs. stress')
xlabel('strain (in/in)')
ylabel('stress (psi)')
errorbar(strain(1:200:end),stress(1:200:end),u_stress(1:200:end),'.','vertical')
errorbar(strain(1:200:end),stress(1:200:end),u_strain(1:200:end),'.','horizontal')
legend('calculated stress and strain','uncertainty in stress','uncertainty in strain')
%plot offset line
x1 = 0.000363009;
x2 = 0.000469177;
y1 = 15511.2;
y2 = 18918.3;
E = (y2-y1)/(x2-x1);%calculate the young's modulus
x_off = 0.002:0.0001:0.0032;
y_off = E*(x_off-0.002);
hold on
plot(x_off,y_off);
legend('0.2 offset line')
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 11 Sep. 2022
Just put '0.2 offset line' as a fourth item in your other legend command.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!