ODE vs. fde12 (solve fractional differential equation)
조회 수: 49 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
답변 (1개)
Kavya Vuriti
2019년 8월 7일
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
Ramashis Banerjee
2020년 7월 31일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!