function ode1

close all
clear

T0 = 0;
T1 = 200;
N = 500;
t = linspace(T0,T1,N);
x0 = [1,2];
%[t,x] = ode45(@my_model,t,x0);
options = odeset('RelTol',1e-5,'AbsTol',[1e-5,1e-6])
[t,x] = ode45(@my_model1,[T0 T1],x0,options);

subplot(2,1,1)
plot(t,x(:,1),'r');
xlabel 't'
ylabel 'x'
title 'ODE Respons'

subplot(2,1,2)
plot(x(:,1),x(:,2),'k')
xlabel 'x'
ylabel 'xdot'
title 'Phase Plane'



function dx = my_model1(t,x)

dx = zeros(2,1);  %column vector
dx(1) = x(2);
dx(2) = cos(x(1))-0.05*x(2)-x(1)-0.02*x(1)^3;

