ODE vs. fde12 (solve fractional differential equation)
41 views (last 30 days)
Show older comments
Hello,
Thanks for contributing fde12. I'm trying to solve a set of coupled equations containing fractional derivatives. To validate that I'm using it correctly, I tested on a simple problem using ODE and fde12 (with alpha=1.0). I would have expected the same result. Unfortunately, they don't. The ODE output makes sense but fde12 output blows up quickly. I'm not sure if I'm using it correctly. Any advice you can provide would be greatly appreciated. Thank you.
-Sheldon
Here's the reaction I'm solving:
A + B < ---- > AB (kon=forward, koff=backward)
| k_el (rate of elimination for B)
V
(nil)
The code I'm running is:
format compact
k_el = 1.7;
kon = 100;
koff = 2.5;
% function definition
myfun = @(t,y) [-kon*y(1)*y(2) + koff*y(3);
-kon*y(1)*y(2) + koff*y(3) - k_el*y(2);
kon*y(1)*y(2) - koff*y(3)];
% using ODE
tspan = [0, 50];
tic; sol = ode23t(myfun,tspan,[4;2.5;0]); toc;
figure(1); plot(sol.x,sol.y); legend; grid;
% using fde12
t0=0; tfinal=50;
h=2^(-6); alpha=1.0;
tic; [t, qsol]=fde12(alpha,myfun,t0,tfinal,[4;2.5;0],h); toc;
figure(2); plot(t,qsol(1,:)); legend; grid;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/232410/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/232411/image.jpeg)
0 Comments
Answers (1)
Kavya Vuriti
on 7 Aug 2019
Assuming y(1),y(2) and y(3) are the first, second and third order derivatives of y, ode23t function has the ability to solve higher order differential equations. For solving these multiterm fractional differential equations, refer to the following function which may solve your problem:
2 Comments
Ramashis Banerjee
on 31 Jul 2020
Could anyone tell me how to solve terminal value problem(integrating backward in time) using the same code??Please help me to solve it numerically.
Reach me at ramashisbanerjee@gmail.com
Thank you in advance.
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!