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

i got these values in matlab but im not sure if its right.Can you code this and

ID: 2085717 • Letter: I

Question

i got these values in matlab but im not sure if its right.Can you code this and if you understand it and/or if my outputs are correct let me know.Im using the program MATLAB to do this assigment.

temp_vector=logspace(0,3,6) %vector of 1 to 1000 lothrithmically space with 6 values each

preesure_vector=logspace(0,3,6) %vector of 1 to 1000 lothrithmically space with 6 values each

%R=0.2870 kJ/(kg K)

[temp_vector,preesure_vector] = meshgrid( temp_vector./preesure_vector) %meshgrid of temp,preesure vectors

temp_vector =

1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1


preesure_vector =

1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1

volume_of_meshgrid = R .* temp_vector ./ preesure_vector %gives volume of air for the meshgrid vector


volume_of_meshgrid =

0.2870 0.2870 0.2870 0.2870 0.2870 0.2870
0.2870 0.2870 0.2870 0.2870 0.2870 0.2870
0.2870 0.2870 0.2870 0.2870 0.2870 0.2870
0.2870 0.2870 0.2870 0.2870 0.2870 0.2870
0.2870 0.2870 0.2870 0.2870 0.2870 0.2870
0.2870 0.2870 0.2870 0.2870 0.2870 0.2870

Problem 3. Problem with Two Variables First, solve the following problem using pen and paper. That is, predict the results and write them down on paper. You may find it helpful to use Excel. Scan your work in PDF format and call it gasLawMesh.pdf. Second, create an m-file called gasLawMesh.m and solve the following inside it: a. b. The ideal gas law, Pv = RT, describes the behavior of many gases, when solved for v (the specific volume, m/kg. the equation can be written In this formulation of the ideal gas law, R is different for every gas. There are other formulations in which R is a constant, and the molecular weight of the gas must be included in the calculation. You'll learn more about this equation in chemistry classes and thermodynamics classes. Create separate vectors for temperatures from 1 to 1000 K and for pressures from 1 kPa to 1000 kPa The vectors should be logarthmically paced and contain sik values each o Hint: use the logspace command. The value of R for air is 0.2870 kJ/(kg K). Find the specific volume, v, for air. Your answer should be a two-dimensional matrix. . o Hint: use the meshgridcommand. Make sure that your code prints the required information to the command line and suppresses other output that is not requested (using the semicolon). After running your script, copy the results (from all steps) from the command line and paste it at the bottom of your script and comment them out. As always, your comment should also explain what numbers you are showing me.

Explanation / Answer

temp_vect = logspace(0,6,6);%10^0 to 10^6(1000k) with 6 values
pres_vect = logspace(3,6,6);%10^3(1kPa)to 10^6(1000k) with 6 values
R = 0.2870;%
[Temp_Vect_2D, Pres_Vect_2D]= meshgrid(temp_vect,pres_vect);%converts two 1D vectors into two 2D vectors
Volume1 = R*Temp_Vect_2D./Pres_Vect_2D;

Command window output;

>> Volume1

Volume1 =

0.0003 0.0045 0.0721 1.1426 18.1085 287.0000
0.0001 0.0011 0.0181 0.2870 4.5486 72.0911
0.0000 0.0003 0.0045 0.0721 1.1426 18.1085
0.0000 0.0001 0.0011 0.0181 0.2870 4.5486
0.0000 0.0000 0.0003 0.0045 0.0721 1.1426
0.0000 0.0000 0.0001 0.0011 0.0181 0.2870

>>