开发者

Solving an ODE using matlab

开发者 https://www.devze.com 2023-01-15 13:22 出处:网络
I have the following ODE: b\'(t) + k16*b(开发者_如何学Pythont) = k15*a(t) where k15 and k16 are constants.

I have the following ODE:

b'(t) + k16*b(开发者_如何学Pythont) = k15*a(t)

where k15 and k16 are constants.

Any idea on how to solve it?

Thanks! Amit


That's a first order ODE. There's an analytical solution for it (just use an integrating factor). No integration required. http://www.math.hmc.edu/calculus/tutorials/odes/

However, if you want to solve it in MATLAB:

>> k15 = 0.2; k16 = 0.3; % type your constants here
>> a = @(t) t^2; % type your expression for a here
>> dbdt = @(t,b) -k16*b + k15*a(t);
>> tf = 10; % final time of integration
>> b0 = 1; % initial value of b
>> [t,y] = ode45(@dbdt,[0 tf],b0)
>> plot(t,y) % display solution.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号