ecuaciones diferenciales ordinarias
DESCRIPTION
programas de matlab (euler y runge kutta)TRANSCRIPT
![Page 1: ecuaciones diferenciales ordinarias](https://reader035.vdocuments.co/reader035/viewer/2022073120/563dbb16550346aa9aaa2b8d/html5/thumbnails/1.jpg)
function RK2_00 dy/dt+(1/2)y=(1/2)t y(0)=4% y' = -(1/2)y + (1/2)t con y(0)=4% yex= 6 e^(-t/2) - 2 + tclc,clear% Datosy0=4; % Valores Inicialest0=0;Dt=0.01; % incremento de tiempoNDt=1000; % cantidad de Dt a realizarw=0.5; % w=0.5 es Euler Mejorado% % w=1 es Euler Modificado;% Dimensionamientot=zeros(NDt,1); % vector para el tiempoy=zeros(NDt,1); % vector para solución y(t)% Inicialización del primer estado soluciónt(1)=t0;y(1)=y0;% Runge-Kutta 2do Ordenfor j=1:NDt-1
k1=Dt*(-(1/2)*y(j) + (1/2)*t(j)); yg = y(j) + k1/(2*w); tg = t(j) + Dt/(2*w);k2=Dt*(-(1/2)*yg + (1/2)*tg);y(j+1) = y(j)+(1-w)*k1+w*k2;t(j+1) = t(j)+Dt;
endfigure(1)plot(t,y(:,1),'b');grid onend