Plot Three Variables with Three separate Y axis

5 vues (au cours des 30 derniers jours)
Patrick Lonergan
Patrick Lonergan le 3 Août 2021
Hi I am trying to plot three vairables on one graph. I am currently plotting it two seperate graphs and comparing but it would be really useful if I could plot one graph with all three vairables. The code I am using to produce the two graphs is as below:
yyaxis left
y=plot(failure.RMS)
ylabel("RMS Error")
yyaxis right
y=plot(failure.RollingAverage)
ylabel("rate of change of Power(W/10min)(rolling 500)")
legend("RMS Error of ML prediction","Rate of change of Power")
legend("Location","northwest")
title("RMS Error and Rolling average rate Of Power Prior to failure")
saveas(y,"Rolling_RMS Error1_11",'jpg');
saveas(y,"Rolling_RMS Error1_11",'m');
clf
yyaxis left
y=plot(failure.RMS)
ylabel("RMS Error")
yyaxis right
y=plot(failure.RollingAvePower)
ylabel("rate of change of Power(KW)(rolling 500)")
legend("RMS Error of ML prediction","Rolling Power Average")
legend("Location","northwest")
title("RMS Error and Rolling average Power Prior to failure")
saveas(y,"Rolling_power Error1_11",'jpg');
saveas(y,"Rolling_power Error1_11",'m');

Réponse acceptée

Bjorn Gustavsson
Bjorn Gustavsson le 3 Août 2021
You might use the plotyyy function from the matlab file excange to do just that. Or any of the other functions that show up when searching for plotyyy: FEX: plotyyy.
HTH

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by