Solve the differential equation

9 次查看(过去 30 天)
yo yo
yo yo 2020-6-18
y''-5*y'+6y=e^(-x)

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-6-18
编辑:Ameer Hamza 2020-6-18
xspan = [0 5];
ic = [1; 0]; % initial condition
[t, y_sol] = ode45(@odeFun, xspan, ic);
plot(t, y_sol);
legend({'y', 'dot\_y'});
function dydx = odeFun(x, y)
dydx = [y(2);
5*y(2)-6*y(1)+exp(-x)];
end

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by