Solving a Differential Equation Numerically

3 views (last 30 days)
Aditya Goel
Aditya Goel on 1 Jul 2021
Commented: Aditya Goel on 18 Jul 2021
I have the following differential equation:
pch4=@(x,w)a*(1-x)*((1-(alpha*w))^0.5);
ph2O=@(x,w)a*(b-x)*((1-(alpha*w))^0.5);
pO2=@(x,w)a*(c-x)*((1-(alpha*w))^0.5);
ra1=@(x,w)(k1.*k2.*pch4(x,w).*pO2(x,w)./((k1.*pO2(x,w)*(1+(Kp.*ph2O(x,w))))+(2.*k2.*pch4(x,w))+(k1.*k2.*pch4(x,w).*pO2(x,w)./k3)))
ode= diff(x,w)==-ra1(x,w)/F;
where, a,b,c k1,k2,k3,Kp, F are known parameters.
I was wondering how to solve it numerically, since I get the following error while using ode45:
Mixture of single and double data for 't0', 'y0', and 'f(t0,y0)' in call to
ode45.
> In odearguments (line 119)
In ode45 (line 115)
  2 Comments
Aditya Goel
Aditya Goel on 18 Jul 2021
I approached the modelling a different way, thank you

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!