Please Help Me! I can't figure out why pressure comes out to be 18.77 every time. The graph only graphs volume and pressure at 18.77 atm
Mostrar comentarios más antiguos
Using Matlab, calculate the pressure (P) (in atm) of a gas in a container of volume (V) ( in liters) for concentrations of 1 ≤ n ≤ 6 at T = 300 K and for volumes of 0.08 ≤ V ≤ 8 liters, where R = 0.08206 Latm/molK, a = 1.39 L2 atm/mol2, and b = 0.0391 L/mol.
(a) Plot P vs. V for all concentration in one plot using different colors for each concentration. Make sure your axes are properly labeled, including units.
(b) Generate a composite plot of P vs. V in which each concentration is represented by a subplot.
%van derWaals equation: %P = [(n*R*T)/(V-n*b)]-[(n^2*a)/(V^2)] %T = 300K %R = 0.08206 (L*atm)/(mol*K) %a = 1.39 (L^2*atm)/(mol^2) %b = 0.0391 L/mol %Calculate the pressure (atm) of a gas in a container of volume (V)(liters) %For concentrations of 1 <= n <= 6 %For volumes of 0.08 <= V <= 8
%Create a function
function [ P ] = Pressure_AbuHamdeh( ~ )
%Declare variables
R = 0.08206;
T = 300;
a = 1.39;
b = 0.0391;
%For concentrations of 1 <= n <= 6
n = 1:6;
%For volumes of 0.08 <= V <= 8
V = linspace(0.8,8,6);
%van DerWaals equation
P = (n.*R*T)/(V-n.*b) - (n.^2*a)/(V.^2);
plot(V,P,'-p');
xlabel('Volume (Liters)') ylabel('Pressure (atm)') title('Graph of Pressure vs Volume')
end
Respuestas (1)
James Tursa
el 30 de Abr. de 2013
Editada: James Tursa
el 30 de Abr. de 2013
Elementwise division also. E.g.,
P = (n.*R*T)./(V-n.*b) - (n.^2*a)./(V.^2);
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!