f=@(t,y) 4*exp(0.8*t)-0.5*y; tspan = [0 4]; y0 = 2; h = 1; [t,y] = ode_euler(f,tspan,y0,h)

3 visualizzazioni (ultimi 30 giorni)
f=@(t,y) 4*exp(0.8*t)-0.5*y;
tspan = [0 4];
y0 = 2;
h = 1;
[t,y] = ode_euler(f,tspan,y0,h)
why this code is not working

Risposta accettata

Pavel Osipov
Pavel Osipov il 5 Ott 2019
tspan = [0 4];
y0 = 2;
[t1,y1] = ode45(@(t,y) 4*exp(0.8*t)-0.5*y,tspan,y0,h);
figure('name','Reda','color','w');
plot(t1,y1, 'r-','LineWidth',2);grid on;
xlabel('Time');ylabel('Solution y(Time)');
title('And you instead of a blanket substitute solver Euler');

Più risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by