function p = vdweqs(v, t, a, b)
% This function impliments the van der Waals Equation of State.
%
% Provides a template for creating function documentation.
%
% Pre/Post Conditions
%
% Input variables initialized. Returns a value.  
%
% Input(s)
%
% v -- Volume of gas in liters/mole
% t -- Temperature of gas in K.
% a -- van der Waals constant a in l^2*atm/mole^2
% b -- van der Waals constant b in l/mole
%
% Output(s)
%
% p -- Pressure in atm.
%
% Other Variables Used
%
% r = Ideal gas constant in l*atm/(mole*K)
%
% Revsion History
%
% Created 12/8/06 by Dr. C. S. Tritt
%

% Define r.

    r = 0.08206; % Gas constant (l*atm/(mol*K)).
    
% Calculate pressure.

    p = r*t/(v-b)-a/v^2;
    
end % function template.