Not enough input arguments
Ältere Kommentare anzeigen
function X=constT(V,Y)
%defining parameter%
%defining parameter%
global A1 A2 E1 E2 Fa0 Cn2 Co2 T0 deltaCp Cpn2 Cpo2 Cpno Hrxn R Ua Ta
R =8.314;
A1=.04;
A2=.1;
E1=42; % forward activation energy
E2=16000; % backward activation energy
Cn2=1; % feed concentration
Co2=1;
Fa0= Cn2 + Co2;
T0=500 ; % feed temperature
Cpn2 =29.7198; Cpo2=29.051; Cpno =29.3018; %j/mol.K
deltaCp = 2*Cpno-Cpo2-Cpno;
Hrxn = 180.5; % kj/mol at refrence temp 300K
Ua =0.01;
Ta =550;
x=Y(1);
T=Y(2);
ra=A1*exp(-E1/(8.314*T))*(Cn2^2)*((1-x)^2)*((T0/T)^2); % change this
% -ra (correct this)
X(1,1) = ra/Fa0; % X
X(2,1) = (-ra*Hrxn - Ua*(T-Ta))/(Fa0*(Cn2*Cpn2+Co2*Cpo2)); % Temperature T
end
Error message:
constT
Not enough input arguments.
Error in constT (line 22)
x=Y(1);
%code for solving and plotting the ode's:
global Fa0;
Fa0=2;
[Vv,Yv]=ode45('constT',[0:500],[0;500]);
f1=figure;
f2=figure;
f3=figure;
figure(f1);
plot(Vv,Yv(:,1))
hold
grid
title('X vs Volume')
xlabel('Volume')
ylabel('X')
hold off
figure(f2);
plot(Vv,Yv(:,2))
hold
grid
title('T vs Volume')
xlabel('Volume')
ylabel('T')
hold off
% calculating -ra
for i =1:501
ra(i)=Fa0*(Yv(i,1)/Vv(i));
end
figure(f3);
plot(Vv,ra)
hold
grid
title('-ra vs V')
xlabel('Volume')
ylabel('-ra')
hold off
Antworten (1)
It looks like you are running the code without giving the required inputs by hitting f5 or run button. No you should not. You should define the input variables to the function and then call the function in a code or in worskapce.
V = value ; % define V here
Y = value ; % define Y here ;
% Now call the function
X = constT(V,Y) ;
While calling the function see to it that, your are in the folder where function is saved or function is added to the path.
1 Kommentar
Sujay Bharadwaj
am 4 Dez. 2021
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!