Not enough input arguments.

조회 수: 2 (최근 30일)
Faisal ata
Faisal ata 2021년 9월 12일
댓글: Faisal ata 2021년 9월 12일
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

채택된 답변

Alan Stevens
Alan Stevens 2021년 9월 12일
편집: Alan Stevens 2021년 9월 12일
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
Faisal ata
Faisal ata 2021년 9월 12일
Thanks a lot Alan, it's working now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Chemistry에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by