Matlab - Index exceeds the number of array elements. Index must not exceed 1.

 
Vista:
sin imagen de perfil

Index exceeds the number of array elements. Index must not exceed 1.

Publicado por RICKY (2 intervenciones) el 15/10/2022 05:04:41
clc
disp('Temperatura del sistema')
T1=117
T2=273.15+T1
disp('Constante R')
R=8.314472
disp('Constantes de Antoine del 2- propanol')
A1=6.40823
B1=1107.30300
C1=-103.94400
disp('Constantes de Antoine del 1- butanol')
A2=6.54172
B2=1336.026
C2=-96.348
disp('Parámetros de NRTL')
A12=4151.27;
A21=-3027.73;
alpha12=0.3
P1=10^(A1-(B1/(C1+T2)));
fprintf(' Presión de Vapor del Metanol = %0.3f KPa \n',P1);
P2=10^(A2-(B2/(C2+T2)));
fprintf(' Presión de Vapor del Benceno = %0.3f KPa \n',P2);
disp('-Cálculo de presiones para el sistema: ')
x =0:0.1:1;
for i=1:length(x)
%Definir operación para sacar la Presión del Sistema
tau12=A12/(R*T2);
tau21=A21/(R*T2);
G12=exp(-alpha12*tau12);
G21=exp(-alpha12*tau21);
G1=exp((1-x(i))^2*(tau21*(G21/(x(i)+(1-x(i))*G21))^2+((tau12*G12)/((1-x(i))+x(i)*G12)^2)));
G2=exp(x(i)^2*(tau12*(G12/((1-x(i))+x(i)*G12))^2+((tau21*G21)/(x(i)+(1-x(i))*G21)^2)));
PS1(i)=x(i)*G1(i)*P1+(1-x(i))*G2(i)*P2;
fprintf(' %0.3f KPa \n',PS1(i));
end
disp('-Composiciones en vapor (yi):')
for i=1:length(x)
y1(i)= ( x(i)*G1(i)*P1)/ PS1(i) ;
fprintf(' %f \n',y1(i));
end
%Graficar Método de Ideal Temperatura Constante
figure(1)
plot(x,PS1,y1,PS1,'marker','.'),
xlabel('xi,yi'),
ylabel('Presión (KPa)'),
title('Equilibrio liquido-vapor a T cte (Modelo NRTL)'),
text(0,P2-1,'Psat2'),
text(1,P1,'Psat1'),
grid on



Index exceeds the number of array elements. Index must not exceed 1.

Error in untitled (line 33)
PS1(i)=x(i)*G1(i)*P1+(1-x(i))*G2(i)*P2;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder