Merge Three Figures Into One

3 次查看(过去 30 天)
JC.UT
JC.UT 2021-2-3
评论: JC.UT 2021-2-3
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

采纳的回答

VBBV
VBBV 2021-2-3
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Objects 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by