Question: ( 3 ONLY FOR CONTEXT SOLVE 4 PLS ) Assume H 2 behaves as an ideal gas with constant specific heat. A 3 m 3

(3 ONLY FOR CONTEXT SOLVE 4 PLS) Assume H2 behaves as an ideal gas with constant specific heat. A 3 m3
rigid tank holds H2 at
250 kPa and 550 K. The gas is cooled down to 350 K. Without using me40matlab,
determine the final pressure (kPa) and the heat transfer of the system (kJ).
>>[Pf_hand,Q_hand]= hw3partc3
Pf_hand [kPa](double) final pressure
Q_hand [kJ](double) heat transfer during the process
----------------------
4) Repeat Part C.3 but this time with me40matlab. Observe the difference between this
approach and the previous manual calculation.
>>[Pf_lib,Q_lib]= hw3partc4
Pf_lib [kPa](double) final pressure
Q_lib [kJ](double) heat transfer during the process
----------------------
NON EDITABLE CODE PART:
% Part C
% NOTE: finish the local functions for each subproblem in the FUNCTION(s) SECTION
fprintf('
Part C
');
fprintf('
1)
');
[Ti,m_liq2,Tf,Wsys]= hw3partc1;
fprintf('Initial temperature Ti =%g K
',Ti);
fprintf('Final temperature Tf =%g K
',Tf);
fprintf('Mass of liquid of state 2 m_liq2=%g kg
',m_liq2);
fprintf('Total work Wsys =%g kJ
',Wsys);
fprintf('
2)
');
units = hw3partc2;
fprintf('# of required units =%g
',units);
fprintf('
3)
');
[Pf_hand,Q_hand]= hw3partc3;
fprintf('Final pressure Pf_hand =%g kPa
',Pf_hand);
fprintf('Transferred heat Q_hand =%g kJ
',Q_hand);
fprintf('
4)
');
[Pf_lib,Q_lib]= hw3partc4;
fprintf('Final pressure Pf_lib =%g kPa
',Pf_lib);
fprintf('Transferred heat Q_lib =%g kJ
',Q_lib);
-----------------------------
EDITABLE CODE PART:( ADD ONTO IT PLS THANKS)
%4)
function [Pf_lib,Q_lib]= hw3partc4
Pf_lib=0; Q_lib=0;
% Start writing your code under here
----------------------
attached is the me40library to be consulted for the problem
ME40 MATLAB SOFTWARE
The software package contains classes state and process and function thplot. The
following is the description of their use. You can also get the built-in information by typing help
state, help process, help process/get, and help thplot in the MATLAB
command line.
Function thplot
Function thplot displays saturated lines in a graphical form. The following options are
available:
thplot default to 'water'
thplot(substance) substance: 'water','r134a'
The properties displayed on the axes can be chosen from the corresponding selection boxes, and
the units can be chosen by clicking on the units with the right-hand button of the mouse.
Class state
A call
st = state(substance,{property1,value1,units1;property2,value2,units2})
creates an object of class state. Each such object contains the following fields:
st.p pressure (in units of kPa)
st.t temperature (in units of K)
st.v specific volume (in units of m3/kg)
st.u specific energy (in units of kJ/kg)
st.h specific enthalpy (in units of kJ/kg)
st.s specific entropy (in units of kJ/kg K)
st.x quality (fraction)
st.phys 'liquid','sat liquid','twophase','sat vapor','vapor','ideal gas'
st.substance 'water', 'air', 'nitrogen', ...
st.molW molecular weight (kg/kmol)
st.R gas constant
Examples are:
s1= state('water',{'p',1.23,'MPa';'x',0.55,''})
s2= state('water',{'v',0.0011,'' ;'sat','','liquid'})
s3= state('air',{'p',1.23,'bar';'h',2345,''})
The empty units field, '', implies base units (in addition to help state, typing
>>Units.base
displays the base units).
Object of class state can be a single state or a list of states, i.e.,
st =[ st1 st2]
or, equivalently,
UCB, Spring 2024
M. Frenklach Page 2 of 3
ME40, Thermodynamics Last updated 1/9/24
st(1)= st1;
st(2)= st2;
creates an object with two states, st1 and st2, each defined through a call to state.
To get the property values of state st, use the dot syntax, for example,
st.p or st.('p'),
which returns the value of p in base units (i.e., kPa).
Once you created state object st, you can display its states on a thermodynamic diagram via
plot(st) or st.plot
This will display the same diagram as calling thplot, but with states marked with red dots.
Clicking with right-hand button of the mouse on a state dot displays the state number; selecting
this box displays all the property values of the state. Selecting one of them draws a constant-
property line; selecting it again removes this line. Clicking with the right-hand button on a line
connecting states, displays the constant property of the corresponding process if exists.
Class process
Having a set of states, st =[st1 st2... stN], whose length(st)>1, a call
pr = process(st)
creates an object of class process, i.e., a set of connected states,
st(1)-> st(2)->...-> st(end).
When the initial state is the same as the final state, i.e., st =[st1 st2... st1], the call to
process makes a cycle,
st(1)-> st(2)->...-> st(1)
A call with multiple state sets, e.g.,
pr = process([st1 st2 st3 st4 st5 st6],[st4 st2])
creates a split-flux process,
st(1)-> st(2)->...-> st(6) with st4 also connected to st2.
You can get process properties by the following calls to get(pr,..) :

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!