The Lee-Kesler equation is a thermodynamic equation commonly used to estimate the properties of saturated liquid and vapor, along with enthalpy and entropy values for pure substances. The equation can be expressed in terms of reduced variables as:
Z = 1 + B - Q/RT - (A / (RT * B)) * (ln(1 + B/RT) / (Z + B))
where: Z = Compressibility factor A = One of two adjustable parameters of the equation B = One of two adjustable parameters of the equation Q = Heat of vaporization T = Temperature in Kelvin
To apply this equation in Matlab, you must first define A and B constants for the substance of interest. You can then use the equation by creating a function that takes temperature as input and returns the corresponding compressibility factor value. Here's an example Matlab code that implements the Lee-Kesler equation:
main.m379 chars13 lines
Note that the last line is iterating the solution until convergence is reached, which is a common numerical solution approach for this equation. You can then call this function by passing the reduced temperature and constants for the substance:
main.m131 chars5 lines
This would return the compressibility factor value for methane at a temperature of 0.8 times its critical temperature.
gistlibby LogSnag