使用Matlab解决ODE [英] Solving an ODE using matlab

查看:95
本文介绍了使用Matlab解决ODE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下ODE:

b'(t) + k16*b(t) = k15*a(t)

其中k15和k16是常数.

where k15 and k16 are constants.

有什么解决方法的想法吗?

Any idea on how to solve it?

谢谢! 阿米特(Amit)

Thanks! Amit

推荐答案

这是一阶ODE.有一个分析解决方案(只使用一个积分因子).无需集成. http://www.math.hmc.edu/calculus/tutorials/odes/

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/

但是,如果要在MATLAB中解决它:

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.

这篇关于使用Matlab解决ODE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆