Van der Waals’s equation of state for an imperfect gas is

( P + a / v ^ 2) ( v - b ) = R T

where P is the pressure (atm), v is the molar volume (liters/mole), T is the absolute temperature (K), and a (liter2.atm/mol2), and b (liter/mol) are constants that depend on the particular gas. Find

molar volume of carbon dioxide at 3 atm and 320 K. For carbon dioxide, you may use a=3.592

and b=0.04267. (Hint: Use ideal gas law to make your initial guess.)

a) Write a generic MATLAB m-file that uses Newton’s (Newton-Raphson) method to solve for x

given the function f(x), initial guess x0, and error tolerance es. Make use of the attached

pseudocode given for the fixed-point iteration method.

b) Write a MATLAB m-file that uses the generic m-file you have developed in part (a) to solve for

the molar volume of any gas, given the P, T, R, a, and b. Use a relative error tolerance of

0.01% for convergence of molar volume.

c) Run the m-file you have developed in part (b) along with the generic m-file of part (a) for the

case of carbon dioxide given above. Make sure you display the result at each iteration.

d) Plot error as a function of the iteration step. Do not forget to label the axes.

e) MATLAB has a built-in function called fzero to find the real root of a single equation. A

simple representation of its syntax is

fzero(function, x0)

where function is the name of the function being evaluated, and x0 is the initial guess.

Solve the above problem using fzero. Comment on the result by comparing with the result

of (c).

How can i solve this; İ need m-file?