Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Matlab Reduced quantities are often used in thermodynamics: reduced temper

ID: 3160972 • Letter: U

Question

Using Matlab Reduced quantities are often used in thermodynamics: reduced temperature Tr= T/Tc, reduced pressure Pr = P/Pc, and reduced volume Vr = V/Vc, where Tc, Pc, and Vc are the corresponding quantities at the critical point. The ideal gas law can be expressed in terms of the reduced quantities as Pr Vr = 8/3 Tr a) Write a function file that accepts an array of Vr and returns the corresponding arrays of Pr for Tr =1 and 2. That is, the file calculates Pr 1 and Pr 2 that are the arrays for Tr =1 and Tr =2, respectively. Note that the file requires element-by-element operations (how do we do the operations?). b) Write a script file that defines Vr = (0.5, 1, 1.5,3) and calculates Pr 1 and Pr2 using the function file in a)

Explanation / Answer

(a)

%%%%%%%%%%%%%%%%%

function Tr=Treduced(Pr,Vr)
Tr=(3/8)*transpose(Pr)*Vr;
end

%%%%%%%%%%%%%%%%%%

Save the above function as an m-file with the name 'Treduced.m' in your prefered directory.

(b)

%%%%%%%%%%%%%%%%%%%%%%%

%Input both Pr and Vr as row vectors.

Pr=[1 2 3];
Vr=[0.5 1 1.5];
Tr=Treduced(Pr,Vr)

%%%%%%%%%%%%%%%%%%%%%%%

Save this as a separate script file in the same directory and run it.

You will get:

Tr =

0.1875 0.3750 0.5625
0.3750 0.7500 1.1250
0.5625 1.1250 1.6875

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote