ファンデルワールスの状態方程式でp-v関係を求める

clear; close all;
a = 3.59;
b= 0.0427;
R = 0.08206;
T = 300;
v0 = 0.05;
vf = 2;
v = linspace(v0,vf,1000);%m3
p  = R*T./(v-b) - a./v.^2;
semilogx(v,p);
ylim([60 80]);

もういっちょ

clear; close all;
%Parameters for Van der Waals equation (example for CO2)
R = 0.08206; % Gas constant in L·atm/(mol·K)
T = 300; % Temperature in Kelvin
a = 3.59; % Van der Waals constant a (L^2·atm/mol^2)
b = 0.0427; % Van der Waals constant b (L/mol)
% Define molar volume range (V_m) in liters per mole
V_m = linspace(0.05, 2, 1000); % Range of molar volume (L/mol)
% Van der Waals equation for pressure P
P = (R * T ./ (V_m - b)) - (a ./ V_m.^2);
% Plot P vs. V_m
figure;
plot(V_m, P, 'b-', 'LineWidth', 2);
xlabel('Molar Volume (V_m) [L/mol]');
ylabel('Pressure (P) [atm]');
title('Van der Waals Equation: Pressure vs. Molar Volume');
grid on;
xlim([0.06 0.26]);
ylim([65 75]);