Question

In: Mechanical Engineering

The pressure p and volume v of a given mass of gas are connected by the...

The pressure p and volume v of a given mass of gas are connected by the relation

k=(p+a\v^2)(v-b)

where a, b, and k are constants.

Using the composite trapezoidal method, write a MatLab script to approximate the work done by the gas in expanding from an initial volume to a final volume. Express p in terms of v.

Where W = Integral (Pdv)

Solutions

Expert Solution

Here is a MATLAB code that will implement the trapezoidal rule. This code is located in a file called trapezoidal.m. It is executed at the command line prompt by typing:
>> trapezoidal(a,b,nintervals)
where a and b are the lower and upper limits of integration. nintervals is the number of intervals. The function you wish to integrate is listed as the last line of the code. In this sample, f(x) = x.%
% Trapezoidal Method
%function integral = trapezoidal(a,b,nintervals);
dx = (b-a)/nintervals;
npoints = nintervals + 1;
x_vec = [a:dx:b];
integral = funkeval(x_vec(1));
for i = 2:1:nintervals
integral = integral + 2*funkeval(x_vec(i));
end
integral = integral + funkeval(x_vec(npoints));
integral = 0.5*dx*integral;
fprintf(1,'\nUsing the Trapezoidal method \n');
fprintf(1,'to integrate from %f to %f with %i nintervals,\n',a,b,nintervals);
fprintf(1,'the integral is %e \n \n',integral);
function f = funkeval(x)
f = x;


Related Solutions

The ideal gas law PV=nRT relates pressure P, volume V, temperature T, and number of moles...
The ideal gas law PV=nRT relates pressure P, volume V, temperature T, and number of moles of a gas, n. The gas constant R equals 0.08206 L⋅atm/(K⋅mol) or 8.3145 J/(K⋅mol). The equation can be rearranged as follows to solve for n: n=PVRT This equation is useful when dealing with gaseous reactions because stoichiometric calculations involve mole ratios. Part A When heated, calcium carbonate decomposes to yield calcium oxide and carbon dioxide gas via the reaction CaCO3(s)→CaO(s)+CO2(g) What is the mass...
Derive the following statement "T(temperatue)-V(volume) and P(pressure)-V(volume) relationship in the adiabatic changes"
Derive the following statement "T(temperatue)-V(volume) and P(pressure)-V(volume) relationship in the adiabatic changes"
The ideal gas law can be stated as P V = nRT where P = pressure...
The ideal gas law can be stated as P V = nRT where P = pressure in Pascals (Pa) V = volume in cubic meters (m3 ) n = number of moles in moles (mol) R = gas constant = 8.3145m3 Pa / ( K · mol ) T = temperature in Kelvin (K). Using MATLAB or Octave, Write a script that prompts the user for the pressure, the volume, and the temperature; storing each in a variable. The script...
According to Boyle’s law, for a certain gas, pressure an volume are inversely proportional: P =...
According to Boyle’s law, for a certain gas, pressure an volume are inversely proportional: P = 800/V where V is measured in and pressure P in pounds per square inch. a) Find the rate of change of P when V=20 , and interpret its meaning (carefully state the units). b) Find the average rate of change of P when V changes from 20 to 25 . Compare your result with a).
(a) Starting from entropy as a function of pressure and volume, S(P, V), show that d...
(a) Starting from entropy as a function of pressure and volume, S(P, V), show that d S = C V T ( ∂ T ∂ P ) V d P + C P T ( ∂ T ∂ V ) P d V For a certain gas that follows the following equation of state: P(V-b) = RT Where b is a constant (b) Starting from the above relationship show that P(V-b)γ=constant for the reversible adiabatic process. Assume constant heat capacity...
For an ideal gas, consider the molar volume Vm = (V/n) = Vm(T,P). In other words,...
For an ideal gas, consider the molar volume Vm = (V/n) = Vm(T,P). In other words, the molar volume is a function of temperature and pressure. a) Write the total differential dVm. b) Show that dVm is exact. c) Derive an expression for the differential work dw performed in a reversible process by expansion/compression of the gas. d) Show that dw is inexact. e) What is the thermodynamic significance of having an exact differential?
A gas occupies a volume of 0.35 m3 at a pressure of 1.0 atm. The pressure...
A gas occupies a volume of 0.35 m3 at a pressure of 1.0 atm. The pressure is increased linearly with respect to volume until a final pressure of 2.0 atm is reached, with the final volume being 0.20 m3 . a. Can you tell from the given information if this gas is an ideal gas? b. Calculate the work done on the gas during the compression.
What is the pressure (in millimeters of mercury) inside a container of gas connected to a...
What is the pressure (in millimeters of mercury) inside a container of gas connected to a mercury-filled open-end manometer of the sort shown in Figure 9.4 in the textbook when the level in the arm connected to the container is 18.0 cm lower than the level in the arm open to the atmosphere, and the atmospheric pressure reading outside the apparatus is 765.3 mm Hg ?
A quantity of N molecules of an ideal gas initially occupies volume V. The gas then...
A quantity of N molecules of an ideal gas initially occupies volume V. The gas then expands to volume 2V. The number of microscopic states of the gas increases in the expansion. Under which of the following circumstances will this number increases the most? ( i ) if the expansion is reversible and isothermal ( ii ) if the expansion is reversible and adiabatic ( iii ) the number will change by the same amount for both circumstances. Why ?
The van der Waals equation for 1 mole of gas is given by (p +av-2)(v -...
The van der Waals equation for 1 mole of gas is given by (p +av-2)(v - b) = RT. In general, curves of p versus v forvarious values of T exhibit a maximum and a minimum at the twopoints where (δp/δv)T = 0. The maximum and minumum coalesceinto a single point on that curve where(δ2p/δv2)T = 0 inaddition to (δp/δv)T = 0. This point is calledthe "critical point" of the substance and its temperature,pressure, and molar volume are denoted by...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT