How do i plot and label a graph using secondary axis in matlab

2 次查看(过去 30 天)
Hello, I'm trying to plot and label two vertical axes for (A and B) of different scales against the same horizontal axis (U).
U=[1 2 3 4 5 6 7 8];
A=[0.0141 0.0135 0.013 0.0125 0.012 0.0117 0.0113 0.011];
B=[0.142267 0.14271177 0.1430866 0.14334375 0.14357196 0.143885125 0.144042862 0.14423808];

采纳的回答

Sean de Wolski
Sean de Wolski 2016-8-31
U=[1 2 3 4 5 6 7 8];
A=[0.0141 0.0135 0.013 0.0125 0.012 0.0117 0.0113 0.011];
B=[0.142267 0.14271177 0.1430866 0.14334375 0.14357196 0.143885125 0.144042862 0.14423808];
yyaxis left
plot(U,A)
yyaxis right
plot(U,B)
If you're on an older release without yyaxis, then look at plotyy or upgrade.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Two y-axis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by