4_Quarterman_Patrick_LabExam1_Problem2

4_Quarterman_Patrick_LabExam1_Problem2 - R=8.314; %gas...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Patrick Quarterman, Section 4 Problem 2 Script: function [ideal,vanderwall]=GasLaw(n,a,b) %Patrick Quarterman, Section 4 %Lab Exam 1 Problem 2, Gas Law %Inputs: n,a,b (as scalar or vector, no units) T, and V can be modified %below %outputs: P_Ideal (pressure from ideal gas law, no units, vector or scalar) % P_Van_der_Walls (pressure from Van der Walls eq, no units vector % or scalar %Given values: T=290; %temperature in units of K V=.5; %volume in units of m^3
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: R=8.314; %gas constant %Calculations P_Ideal=(n*R*T)/V %ideal gas calculation P_Van_der_Walls=((n*R*T)./(V-n.*b)-(n.^2.*a)/V^2) %vanderwall calculation MATlab Window >> n=[7.56 5.21 15.8 5.89 4.76]; >> a=[.136 .365 .138 .0249 .137]; >> b=[.000037 .000043 .000032 .000027 .000039]; >> GasLaw(n,a,b) P_Ideal = 1.0e+004 * 3.6455 2.5123 7.6189 2.8402 2.2953 P_Van_der_Walls = 1.0e+004 * 3.6445 2.5095 7.6129 2.8408 2.2949...
View Full Document

Ask a homework question - tutors are online