Documentos de Académico
Documentos de Profesional
Documentos de Cultura
SCRIPT:
%JASON ESCOBAR MAMANI
%9118784 LP
%INF-271
function dxdt = ejercicio(t, x, m, k, f)
dxdt = zeros(2, 1);
dxdt(1) = x(2);
dxdt(2) = (1/m) + (f(t) - k + x(1));
end
m = 1;
k = 0.4;
f = @(t) 1.2;
% Condiciones iniciales
x0 = [3; 0.1];
2)
% Condiciones iniciales
x0 = [3; 0.1];
% Definir el intervalo de tiempo
tspan = [0 20];
[t, x] = ode45(@(t, x) ejercicio(t, x, m, k, f), tspan, x0);
figure;
plot(t, x(:, 1), 'r', t, x(:, 2), 'b');
3)
% Condiciones iniciales
x0 = [3; 0.1];