How can i run this code? I get erros "Unable to perform assignment because the size of the left side is 1-by-600 and the size of the right side is 1-by-100."
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
%Plot P-V diagram of a given substance using van der Waals 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 = 4.086; % ft3/lbmole
R = 10.732; % psi ft3/(lbmole-R)
% van der Waals Equation of State Constants
% for Propane
a = 54565.6;
b = 1.9639;
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.250 1.118 1.069 1.031 1.0049 0.999];
%van der Waals Equation
fvdWEOSp = @(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 i= 1:numel(T)
    Tx = T(i);
    Hx = H(i);
    P(i,:) = fvdWEOSp(Tx,V,Hx);
end
% plot(V,P); xlim([0 800]);
semilogx(V,P); xlim([1 800]);
ylim([0 2000]);
xlim([0 1000]);
xlabel('Volume, ft^3');
ylabel('Pressure, psi');
댓글 수: 0
답변 (1개)
  Matt J
      
      
 2022년 5월 19일
        for j=1:numel(H)
    for i= 1:numel(T)
        Tx = T(i);
        Hx = H(j);
        P(i,:,j) = fvdWEOSp(Tx,V,Hx);
    end
end
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Class Introspection and Metadata에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

