How to make this plot?

13 次查看(过去 30 天)
Yasmin Marsya
Yasmin Marsya 2023-6-10
编辑: Samya 2023-6-12
Develop a program that displays an isotherms profile of hydrogen gas (PV diagram)
at a range of temperature of 30 to 90 °C for 20 °C interval and at a range of pressure
between 1 – 50 bar. The profile must be completed with title, axis labels, and legend.
Make sure to differentiate the series with different markers and different line types only,
the colour of the lines and markers must be black. Assume that the gas behaves as an
Ideal Gas Law and the program should request the user to input the amount of
substance of the hydrogen.
  1 个评论
Star Strider
Star Strider 2023-6-10
Use the hold function to plot all of them on the same axes.
Beyond that, solve this:
for one of them as a function of the other, and plot the result.

请先登录,再进行评论。

回答(1 个)

Samya
Samya 2023-6-10
编辑:Samya 2023-6-12
Hi @Yasmin Marsya! Below is how you can approach to solve your question.
  1. Input the amount of substance of hydrogen gas (n)
  2. Define temperature range from 30 to 90 °C with 20 °C interval and pressure range from 1 to 50 bar
  3. Create a grid for temperature and pressure
  4. Calculate the volume of hydrogen gas using the Ideal Gas Law formula
% Creating a grid for temperature and pressure
[T, P] = meshgrid(T_range, P_range);
% Calculating the volume of hydrogen gas using Ideal Gas Law
V = (n * 8.314 * (T + 273.15)) ./ (P * 1e5);
5. Plot the isotherm profiles using the temperature and pressure as x and y-axis respectively and volume as a function
6. For each temperature values,
a) Set the marker to 'o', Line style to '-', and lineWidth to 2
b) Plot the isotherm profile, volume (y-axis) vs pressure (x-axis)
7. Add title, axis labels, legend and customize axes display,
a) Title - 'Isotherm Profile of Hydrogen Gas (30 to 90°C)'
b) X-Label - 'Volume (m^3)'
c) Y-Label - 'Pressure (bar)'
d) Legend - Show each temperature with a marker and line style used for the respective isotherm
e) Customize Axes display:
i) Set box on
ii) Set grid on
iii) Set plot background to white
iv) Set axis tick label font size and display precision
v) Set limit for x and y-axis based on the highest and lowest value of volume and pressure, respectively
Hope this helps! For any further clarifications do comment!
  1 个评论
Dyuman Joshi
Dyuman Joshi 2023-6-11
We do not recommended fully solving Homework assignments on MATLAB Answers. If you want to help, give hints (e.g mentioning which functions can be of use or linking some similar question that has been answered before) or provide a pseudocode.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Volume Visualization 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by