Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

MATLAB QUESTION The above function is written to calculate the volumes using both the ideal gas law and the virial equation of state ( a volumetric parameter like van der waals). The user defined inputs are given in he initial function line (pressure, virial coefficients A, B, C, D, moles, and temperature). "Temp" is a vector. The function creates two vectors, Vid (ideal gas volume) and Vvir (Virial equation volume). Please find the errors (probably about 25 errors) ffunction [ Volume ] = idvsvir( pressure,moles,A,B,C,D,Temp) %UNTITLED2 Summary of this function goes here % Detailed exp

OpenStudy (anonymous):

ffunction [ Volume ] = idvsvir( pressure,moles,A,B,C,D,Temp) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here R=.08026; Temp=[10,45,68,125,200]; index2=1; index3=0; index4=1; Volume(index4)=0; r=roots(vir); L2=length(r); imgcheck=imag(r); for x=1:1:length(temp) for index=1:(L2-2) if imgcheck(index)==0 Volreal(index2)=r(index); index2=index2+1; end end L3=length(Volreal); for d=1:L3 if Volreal(d)<0 break elseif Volreal(d)>=0 Volume(index4)=Volreal(d); index4=index4+1; end end Vvir(x)=Volume(index4) end vir(1)=(1/3)^3; vir(2)=B/(n^2); vir(3)=(C-pressure*moles/R*Temp); vir(4)=D; pressure=Moles*R*Temp/Vid; Disp(Vvir) Disp(Vid)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!