Merge Three Figures Into One
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This will generate 3 separate figures , how can I get it onto one figure ?
clear all;
clc;
hi=5.5*1e6; %heat input=5.5*10^(-6) Btu/h
time=4200; %time=4200 hours
cost=[4*1e-6,5*1e-6,6*1e-6]; %cost is per million Btu
eff1=0.7; %efficiency = 0.7
%tuning efficiency varying from 0.7 to 0.9
eff=linspace(0.7,0.9,10);
for i=1:3
j=1;
for eff2=linspace(0.7,0.9,10);
annual_energy(j)=hi*time*eff2;
cost_saving(j)=cost(i)*hi*time*(eff2-eff1);
j=j+1;
end
figure %opens new figure
[hAx,hLine1,hLine2]=plotyy(eff,annual_energy,eff,cost_saving);
xlabel('Efficiency');
ylabel(hAx(2),'Cost saving in $');
ylabel(hAx(1),'Annual Energy in Btu');
legend('Annual Energy','Cost Saving');
title(['Annual Energy and Cost Saving vs Efficiency at $',num2str(cost(i))]);
end
0 commentaires
Réponse acceptée
VBBV
le 3 Fév 2021
clear all;
clc;
hi=5.5*1e6; %heat input=5.5*10^(-6) Btu/h
time=4200; %time=4200 hours
cost=[4*1e-6,5*1e-6,6*1e-6]; %cost is per million Btu
eff1=0.7; %efficiency = 0.7
%tuning efficiency varying from 0.7 to 0.9
eff=linspace(0.7,0.9,10);
for i=1:3
j=1;
for eff2=linspace(0.7,0.9,10);
annual_energy(j)=hi*time*eff2;
cost_saving(j)=cost(i)*hi*time*(eff2-eff1);
j=j+1;
end
subplot(3,1,i)%figure %opens new figure
[hAx,hLine1,hLine2]=plotyy(eff,annual_energy,eff,cost_saving);
xlabel('Efficiency');
ylabel(hAx(2),'Cost saving in $');
ylabel(hAx(1),'Annual Energy in Btu');
legend('Annual Energy','Cost Saving');
title(['Annual Energy and Cost Saving vs Efficiency at $',num2str(cost(i))]);
end
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Objects dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!