Second order ODE with initial and final condition
1 次查看(过去 30 天)
显示 更早的评论
I am trying to numerically solve the following second order differential equation:
In general A could be a matrix, but for simplicity, I focus on the case where A is a function of t, and a, m & K are constants. I have the initial condition:
and final condition:
How can I specify an initial and a final condition using ode45 or similar?
What can I put for Y0 in my codes below?
function dy= ode_func(t,y)
a=.01; m=100; K=.001;
dy = zeros(2,1);
dy(2)= a/t * exp(-m*t) -K;
dy(1)= y(2);
with main script:
[T,Y] = ode45(@ode_func, [0,100], Y0);
Plot(T,Y)
Thank you,
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!