ODE 15 solver, "Too many output arguments."

The basics, I am trying to Solve to ODE's using ODE15s, I have one M-file that asks for user inputs and assigns them to variables. But, when i run it I get an error "Too many output arguments. ====> alpha". How do I fix this? As you can probably tell from the code I am whats 10 levels below beginner. Oh and Im solving for pressure drop in a packed bed reactor.
Thanks,
1st Mfile
function dp = packbed(~,p)
dp = zeros(2,1);
dp(1) = (-1)*(alpha*((p0)^2))/(p(1))*((1+(ep))* p(2));
dp(2) = ((k)*(ca0)/(v0))*((1-p(2))/(1+(ep)*p(2)))*(((p(1))/(p0))^2); end
2nd Mfile
alpha1 = input('please enter a value for Alpha (Kg^-1):');
alpha = sprintf('%0.6f', alpha1);|
p01 = input('please enter a value for the initial pressure (atm):');
p0 = sprintf('%0.6f', p01);
% Epsilon is represented as "ep".
ep1 = input('please enter a value for Epsilon:');
ep = sprintf('%0.6f', ep1);
% k is represented as the rate constant.
k1 = input('please enter a value for the rake constant(m^3/kmol*kg*cat*h):');
k = sprintf('%0.6f', k1);
% v0 is the initial volume.
v01 = input('please enter a value for the initial volume (m^3):');
v = sprintf('%0.6f', v01);
% ca0 is the initial concentration of A at the inlet.
ca01 = input('please enter a value for the initial consentration of A (kmols/m^3):');
ca0 = sprintf('%0.6f', ca01);
pnot = [p0 0];
vnot = [v0 0];
wspan = [0 60];
run packbed
u = input('If you would like a plot of "Pressure vs Weight of the catalyst" type 1, or "Volume vs Weight of the catalyst" type 2:');
if u==1
[p,w] = ode15s(@packbed, wspan, pnot);
plot(p,w(:,1));
elseif u==2
[v,w] = ode15s(@packbed, wspan, vnot);
plot(v,w(:,1));
else
disp('If you would like a plot of "Pressure vs Weight of the catalyst" type 1, or "Volume vs Weight of the catalyst" type 2:');
end

 Réponse acceptée

Grzegorz Knor
Grzegorz Knor le 3 Déc 2011

0 votes

alpha is a matlab function. It set transparency properties for objects in current axes.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by