MATLAB Answers

Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

0

Can i create a function that will plot more than one figure?

Panagiotis Maximos Sifneos さんによって質問されました 2018 年 3 月 15 日
最新アクティビティ Venkata Siva Krishna Madala さんによって 回答されました 2018 年 3 月 19 日
So i want to create a function of the form:
function isoplot(x,y)
plot(x,y)
end
that will output 5 different figures. At the moment, in my main script I have:
figure (1) %add new plot
plot (final_product_iso(:,1),final_product_iso(:,2)) %plot the molar flow rate of MA at riser outlet vs. values of catalyst re-circulation rate i
title ('Isothermal - Molar Flow of MA vs. Catalyst Re-Circulation Rate')
figure (2) %add new plot
plot (final_product_iso(:,1),final_product_iso(:,3)) %plot the outlet temperature vs. the catalyst re-circulation rate
title ('Isothermal - Outlet Temperature vs. Catalyst Re-Circulation Rate')
figure (3) %add new figure
plot (final_product_iso(:,1),final_product_iso(:,4)) %plot butane conversion at the outlet vs. catalyst re-circulation rate
title ('Isothermal - Butane Outlet Conversion vs. Catalyst Re-Circulation Rate')
figure(4) %add new plot
plot (final_product_iso(:,1),final_product_iso(:,5)) %plot MA outlet selectivity vs. catalyst re-circulation rate.
title ('Isothermal - MA Outlet Selectivity vs. Catalyst Re-Circulation Rate')
figure (5) %add new plot
plot (final_product_iso(:,4),final_product_iso(:,5)) %plot the maleic anhydride selectivity vs. butane conversion.
title ('Isothermal - MA Outlet Selectivity vs. Butane Conversion')
where final_product_iso has already been defined.
How can i put all that into 1 function and call it once?
Thanks

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: Venkata Siva Krishna Madala 2018 年 3 月 19 日

Hello Panagiotis Maximos Sifneos,
You can do it by creating a MATLAB function as described below.
function isoplot(x)
figure (1) %add new plot
plot (x(:,1),x(:,2)) %plot the molar flow rate of MA at riser outlet vs. values of catalyst re-circulation rate i
title ('Isothermal - Molar Flow of MA vs. Catalyst Re-Circulation Rate')
figure (2) %add new plot
plot (x(:,1),x(:,3)) %plot the outlet temperature vs. the catalyst re-circulation rate
title ('Isothermal - Outlet Temperature vs. Catalyst Re-Circulation Rate')
figure (3) %add new figure
plot (x(:,1),x(:,4)) %plot butane conversion at the outlet vs. catalyst re-circulation rate
title ('Isothermal - Butane Outlet Conversion vs. Catalyst Re-Circulation Rate')
figure(4) %add new plot
plot (x(:,1),x(:,5)) %plot MA outlet selectivity vs. catalyst re-circulation rate.
title ('Isothermal - MA Outlet Selectivity vs. Catalyst Re-Circulation Rate')
figure (5) %add new plot
plot (x(:,4),x(:,5)) %plot the maleic anhydride selectivity vs. butane conversion.
title ('Isothermal - MA Outlet Selectivity vs. Butane Conversion')
end
Later you can call the function in the main script with final_product_iso as the argument.
isoplot(final_product_iso)
Regards,
Krishna Madala

  0 件のコメント

サインイン to comment.



Translated by