I want to integrate froma function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Rodrigo Blas
am 22 Mär. 2020
Kommentiert: Ameer Hamza
am 22 Mär. 2020
function prob7f=xequil(x,cao,ep,k2,kc,Fao)
ca=cao*(1-x)./(1+ep*x);
cb=cao*(1-x)./(1+ep*x);
cc=2*cao*x./(1+ep*x);
ra=-(k2*(ca-(cb*cc)./kc));
prob7f=Fao./(-ra);
end
z=@xequil;
volpfreq=integral(z,0,xf);
>> Jallohw5p7
Not enough input arguments.
Error in xequil (line 3)
ca=cao*(1-x)./(1+ep*x);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] =
iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in Jallohw5p7 (line 32)
volpfreq=integral(z,0,xf);
All other varables are defined, except x of course, which is the variables I want to solve for.
2 Kommentare
Ameer Hamza
am 22 Mär. 2020
What are values of cao,ep,k2,kc,Fao? Where are they defined? You need to define them inside the function.
Akzeptierte Antwort
Ameer Hamza
am 22 Mär. 2020
The integral function should be called like this
z=@(x) xequil(x, cao, ep, k2, kc, Fao);
volpfreq=integral(z,0,xf);
Also change the following line in the function xequil
ra=-(k2*(ca-(cb*cc)./kc));
with
ra=-(k2.*(ca-(cb.*cc)./kc));
2 Kommentare
Ameer Hamza
am 22 Mär. 2020
You also changed the last line
prob7f=(Fao/(-ra));
change it back to
prob7f=(Fao./(-ra));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Computations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!