フィルターのクリア

Merge Three Figures Into One

1 回表示 (過去 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
  2 件のコメント
VBBV
VBBV 2021 年 2 月 3 日
use a subplot for merging figures
JC.UT
JC.UT 2021 年 2 月 3 日
Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by