# Error using semilogx Data cannot have more than 2 dimensions. Error in aaaa (line 39) semilogx(V,P); xlim([1 100]); HOW CAN I SOLVE THİS PROBLEM? PLEASE HELP ME

1 view (last 30 days)
Mustafa Batuhan Turaç on 25 May 2022
%Plot P-V diagram of a given substance using peng-Robinson equation of states
%Substance properties are defined by the van der Waals constants and
%the critical properties.
clc; clear; close all;
Tc = 765.62; % R
Pc = 550.60; % psi
Vc = 0.0703; % ft3/lbmole
R = 10.732; % psi ft3/(lbmole-R)
% peng-Robinson Equation of State Constants
% for n-Butane
a = 54566;
b = 1.161;
V = linspace(b*1.2,40*Vc,100); % vector of volume
% temperature in F
T = [60 180 230 270 300 306];
T = T + 460; % temperature in R
H = [1.2501 1.1184 1.0692 1.0318 1.0049 0.9996];
% peng-Robinson Equation
fPRWEOSp = @(Tx,Vx,Hx)(R*Tx./(Vx-b)-a*Hx./(Vx.^2 + 2*Vx*b-b^2));
P = zeros(numel(T), numel(V), numel(H));
for j=1:numel(H)
for i= 1:numel(T)
Tx = T(i);
Hx = H(j);
P(i,:,j) = fPRWEOSp(Tx,V,Hx);
end
end
% plot(V,P); xlim([0 100]);
semilogx(V,P); xlim([1 100]);
ylim([0 800]);
xlabel('Volume, ft^3');
ylabel('Pressure, psi');
Error using semilogx
Data cannot have more than 2 dimensions.
Error in aaaa (line 39)
semilogx(V,P); xlim([1 100]);

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by