Not enough input arguments.

2 visualizaciones (últimos 30 días)
Faisal ata
Faisal ata el 12 de Sept. de 2021
Comentada: Faisal ata el 12 de Sept. de 2021
Hello everyone,
I just got a code and when I run it ,I get this error :
Not enough input arguments.
NT = YY(1)+YY(2)+YY(3)+YY(4)+(0.45* YY(3)* (YY(2)/ YY(4)));
Here is the code:
global PT S DELH Q CPA CPB CPC CPD NA NC NB ND NE NT
PT = 1.5; % PT is total pressure in atmospheres
S = 0.05; % S= 0.5 square meters of area
DELH = 206014; % DELH is heat of reaction in Joules per gram mole
Q = 5000; % Heat input rate per unit lenth of bed (Joules/min-meter)
CPA = 36.9607; % specific heat (J/gmole-K)
CPB = 33.7295; % specific heat (J/gmole-K)
CPC = 29.1668; % specific heat (J/gmole-K)
CPD = 28.6455; % specific heat (J/gmole-K)
zz0 = 0.0;
zzf = 0.5;
YY0 = [3;3.5;0;0.000001;1300];
[zz,YY] = ode23(chrlspr3,zz0,zzf,YY0);
K = 0.45; % For now, K is assumed to be independent of temperature, K = constant
NA= YY(:,1);
NB= YY(:,2);
NC= YY(:,3);
ND= YY(:,4);
T = YY(:,5);
NE= .45* YY(:,3).* YY(:,2)./YY(:,4);
NT= NA+NB+NC+ND+NE;
plot(zz,NA,'r+',zz,NB,'g-')
title('MOLES/MIN versus REACTOR LENGTH')
xlabel(' Reactor Length')
ylabel('Gram-moles/min')
grid
pause, close
plot(zz,NC,'b-.',zz,ND,'y--',zz,NE,'r+')
title('MOLES/MIN versus REACTOR LENGTH')
xlabel(' Reactor Length')
ylabel('Gram-moles/min')
grid
pause, close
plot(zz,T)
title('TEMPERATURE versus REACTOR LENGTH')
xlabel('Reactor Length')
ylabel('TEMPERATUTE 0K')
grid
function W = chrlspr3(YY)
global PT S DELH Q CPA CPB CPC CPD NA NB NC ND NE NT T
S= 0.01;
NT = YY(1)+YY(2)+YY(3)+YY(4)+(0.45* YY(3)* (YY(2)/ YY(4)));
NTCP=YY(1)*CPA + YY(2)*CPB + YY(3)*CPC + YY(4)*CPD;
W(1)=-1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W(2)=-1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W(3)= 1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W(4)=3*1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W(5)=(-S*DELH*W(3)+Q)/(NTCP);
end
Please help me out.
Thanking you

Respuesta aceptada

Alan Stevens
Alan Stevens el 12 de Sept. de 2021
Editada: Alan Stevens el 12 de Sept. de 2021
Like this?:
global PT S DELH Q CPA CPB CPC CPD NA NC NB ND NE NT
PT = 1.5; % PT is total pressure in atmospheres
S = 0.05; % S= 0.5 square meters of area
DELH = 206014; % DELH is heat of reaction in Joules per gram mole
Q = 5000; % Heat input rate per unit lenth of bed (Joules/min-meter)
CPA = 36.9607; % specific heat (J/gmole-K)
CPB = 33.7295; % specific heat (J/gmole-K)
CPC = 29.1668; % specific heat (J/gmole-K)
CPD = 28.6455; % specific heat (J/gmole-K)
zz0 = 0.0;
zzf = 0.5;
YY0 = [3;3.5;0;0.000001;1300];
[zz,YY] = ode23(@ chrlspr3,[zz0 zzf],YY0);
K = 0.45; % For now, K is assumed to be independent of temperature, K = constant
NA= YY(:,1);
NB= YY(:,2);
NC= YY(:,3);
ND= YY(:,4);
T = YY(:,5);
NE= .45* YY(:,3).* YY(:,2)./YY(:,4);
NT= NA+NB+NC+ND+NE;
plot(zz,NA,'r+',zz,NB,'g-')
title('MOLES/MIN versus REACTOR LENGTH')
xlabel(' Reactor Length')
ylabel('Gram-moles/min')
grid
figure(2)
plot(zz,NC,'b-.',zz,ND,'y--',zz,NE,'r+')
title('MOLES/MIN versus REACTOR LENGTH')
xlabel(' Reactor Length')
ylabel('Gram-moles/min')
grid
figure(3)
plot(zz,T)
title('TEMPERATURE versus REACTOR LENGTH')
xlabel('Reactor Length')
ylabel('TEMPERATUTE 0K')
grid
function W = chrlspr3(~,YY)
global PT S DELH Q CPA CPB CPC CPD NT
S= 0.01;
NT = YY(1)+YY(2)+YY(3)+YY(4)+(0.45* YY(3)* (YY(2)/ YY(4)));
NTCP=YY(1)*CPA + YY(2)*CPB + YY(3)*CPC + YY(4)*CPD;
W3 = 1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W =[-1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
-1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
W3
3*1.02*(10^6)*S*(0.10949*PT*YY(1)/NT)/(1+0.239*YY(2)/YY(4)+17.62*YY(3)*PT/NT);
(-S*DELH*W3+Q)/(NTCP)];
end
  1 comentario
Faisal ata
Faisal ata el 12 de Sept. de 2021
Thanks a lot Alan, it's working now

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Chemistry en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by