You are on page 1of 2

Problem 1 part d

Code:
clear
close all

xlist = -2*pi():0.5:2*pi(); % just for plotting purposes


ylist = xlist;
w0=1;
mu0=1;
mu1=1;
e=0.1;
for i = 1:length(xlist)
for j = 1:length(ylist)

x01 = [xlist(i) ylist(j)];

tt=linspace(0,10, 100);

[tout1, yout1] = ode45( @(t,y) f3(t,y,w0,mu0,mu1,e), tt, x01);


[tout2, yout2] = ode45( @(t,y) f3(t,y,w0,mu0,mu1,e), -tt, x01);

plot( yout1(:,1), yout1(:,2)); hold on


plot( yout2(:,1), yout2(:,2))

hold on;
end
end

ylim([-3, 3])
xlim([-6, 10])
axis equal
grid on

function dot = f3(t,YY,w0,mu0,mu1,e)


x=YY(1);
y=YY(2);
dot(1,:) = y;
dot(2,:) = -w0^2*x-e*(2*mu1*y-mu0*sign(y));
end
We can see the limit cycle at 0.64 approximately.

You might also like