Not enough Input Arguments

Hello,
I am trying to solve following code:
function dCb = buffer1(pH,Cb,Cw,Kws, Ca, Ka)
phspan = [2,13];
Cb0 = [0.02; 0];
Cw = 55.5;
pKw= 14;
Kw = 10^(-pKw);
Kws = Kw/Cw;
Ca= 0.01;
Ka= 2*10^-5;
dCb = 2.303*(10^(-pH)+(Ca*Ka*10^(-pH)/(10^(-pH)+Ka)^2)+(Cw*Kws*10^(-pH)/(10^(-pH)+Kws)^2)); %HIGHLIGHT HERE
ode = @(ph, Cb) buffer1(ph, Cw, Kws, Ca, Ka)
[ph. Cb] = ode45(ode, phspan, Cb0)
But i am getting error of NOT ENOUGH INPUT ARGUMENTS(at line 11-highlighted) I don't understand what is missing. Can anybody help me plz.
Thanks in advance:
Zia

Réponses (1)

Walter Roberson
Walter Roberson le 8 Nov 2011

0 votes

Your function handle "ode" accepts two input arguments, ignores the second of them (Cb), and calls buffer1() with 5 arguments.
function buffer1 expects 6 input arguments, not 5; in particular it expects its second input argument to be Cb, which your "ode" function handle does not pass to it.

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Tags

Question posée :

Zia
le 8 Nov 2011

Community Treasure Hunt

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

Start Hunting!

Translated by