How to make this plot?

7 views (last 30 days)
Yasmin Marsya
Yasmin Marsya on 10 Jun 2023
Edited: Samya on 12 Jun 2023
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 Comment
Star Strider
Star Strider on 10 Jun 2023
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.

Sign in to comment.

Answers (1)

Samya
Samya on 10 Jun 2023
Edited: Samya on 12 Jun 2023
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 Comment
Dyuman Joshi
Dyuman Joshi on 11 Jun 2023
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.

Sign in to comment.

Categories

Find more on Gas Models in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!