Van der Waals Equation-of-State for one mole of a gas is given as $$P(V,T)=\frac{RT}{(V-b)}-\frac{a}{V^2}$$ Now, I have been asked to plot the corresponding P-V curve over Matlab for a given set of $(T, a, b, R, P_0)$, by varying $P$ around $P = P_0$. How to proceed? FWIW, the curve can be easily plotted if I am allowed to vary $V$ instead.
Solution over similar software like Octave/Mathematica will suffice.
One potential solution is to think of your equation as $V = V(P)$ and write an equation for $V$ given some number $P$. If you do the algebra, this becomes
$$ V^3 - \bigg(b + \frac{RT}{P}\bigg)V^2+\frac{a}{P}V = \frac{ab}{P} $$
From here, you can vary $P$ around $P_0$, for example in MATLAB with $P = $linspace($P_0-\delta$,$P_0+\delta$), and then tell MATLAB to solve the algebraic equation for $V(P)$. From there, you can plot $P$ vs $V$ as you'd like.