Plotting function g(v) against p(v)

46 Views Asked by At

I have a function g(v) which is Gibbs free energy and another function which is p(v) which is described by Vanderwaal's model. Anyway I need to plot g as a function of v but I am unsure of how to do it, they are both related as they are functions of v but I tried and failed to rearrange p(v) in terms of v(p) because there is a polynomial sort of term $v^2 + v$. The functions are $p = \frac{8.t}{3.v-1}-\frac{6}{v^2}$ where t can be treated as a constant. and, $g = \frac{8.t}{3}.ln(3.v-1) - \frac{8t}{9v-3}-\frac{6}{v}+c(t)$ where c(t) is a constant, which is a function of t (but since we are holding t constant it is just a constant) Here is the matlab code for the formulas: '''t = 0.95; v = 0.5:0.0001:3; g = ((8/3)*t).*log((3.*v)-1)+(8/3).*t./((3.*v)-1)-6./v; p = (8*t)./(3.*v-1) - 3./v.^2;''' I am trying to make the graph look like the following:

1

There are 1 best solutions below

1
On BEST ANSWER

If you cannot use a parametric plot function, since the calculations will be very fast, do the following

  • assign a value to $V$ and compute $P$ from the equation of state. We do not care if $P <0$

  • using this $V$ compute $G$

  • Now, you have a table $(V_i,P_i,G_i)$