In: Advanced Math
For each of the following problems (even the book ones) do the following:
a. Use the x- and y- nullclines to find all the equilibrium points.
b. Compute the Jacobian matrix of the system.
c. Determine the type of each equilibrium point (if it is a hyperbolic equilibrium).
d. Plot the phase portrait in CoCalc.
1. dx/dt = x-xy-8x^2
dy/dt = -y+xy
2. dx/dt = x-y+x^2
dy/dt = x+y
3. dx/dt = 8x-4x^2-xy
dy/dt = 3y-3xy-y^2
4. dx/dt = y-x^2y
dy/dt = -x+xy^2
Mathlab Code
% Question :1
f = @(t,Y) [-Y(1)-Y(1)*Y(2)-8*(Y(1))^2; Y(1)*Y(2)-Y(2)];
y1 = linspace(-10,10,20);
y2 = linspace(-10,10,20);
[x,y] = meshgrid(y1,y2);
%size(x)
%size(y)
u = zeros(size(x));
v = zeros(size(x));
hold on
plot(0,0, 'g.', 'MarkerSize', 25);
hold on
plot(1,-9, 'g.', 'MarkerSize', 25);
hold on
plot(-1/8,0, 'g.', 'MarkerSize', 15);
hold on
t=0;
for i = 1:numel(x)
Yprime = f(t,[x(i); y(i)]);
u(i) = Yprime(1);
v(i) = Yprime(2);
end
quiver(x,y,u,v,'r'); figure(gcf)
xlabel('y_1')
ylabel('y_2')
axis tight equal;
% Question 2:
f = @(t,Y) [Y(1)+(Y(1))^2*-Y(2); Y(1)+Y(2)];
y1 = linspace(-5,10,800);
y2 = linspace(-5,10,800);
[x,y] = meshgrid(y1,y2);
%size(x)
%size(y)
u = zeros(size(x));
v = zeros(size(x));
hold on
plot(0,0, 'g.', 'MarkerSize', 25);
hold on
plot(-2,2, 'g.', 'MarkerSize', 25);
hold on
t=0;
for i = 1:numel(x)
Yprime = f(t,[x(i); y(i)]);
u(i) = Yprime(1);
v(i) = Yprime(2);
end
quiver(x,y,u,v,'r'); figure(gcf)
xlabel('y_1')
ylabel('y_2')
axis tight equal;
% Question :3
f = @(t,Y) [8*Y(1)-Y(1)*Y(2)-4*(Y(1))^2;
-3*Y(1)*Y(2)-+3*Y(2)-(Y(2)^2)];
y1 = linspace(-10,10,20);
y2 = linspace(-20,10,20);
[x,y] = meshgrid(y1,y2);
%size(x)
%size(y)
u = zeros(size(x));
v = zeros(size(x));
hold on
plot(0,0, 'g.', 'MarkerSize', 25);
hold on
plot(0,3, 'g.', 'MarkerSize', 25);
hold on
plot(2,0, 'g.', 'MarkerSize', 15);
hold on
plot(5,-12, 'g.', 'MarkerSize', 15);
hold on
t=0;
for i = 1:numel(x)
Yprime = f(t,[x(i); y(i)]);
u(i) = Yprime(1);
v(i) = Yprime(2);
end
quiver(x,y,u,v,'r'); figure(gcf)
xlabel('y_1')
ylabel('y_2')
axis tight equal;
% Question 4 :
f = @(t,Y) [Y(2)-((Y(1))^2)*Y(2); -Y(1)+Y(1)*(Y(2)^2)];
y1 = linspace(-4,5,20);
y2 = linspace(-4,5,20);
[x,y] = meshgrid(y1,y2);
%size(x)
%size(y)
u = zeros(size(x));
v = zeros(size(x));
hold on
plot(0,0, 'g.', 'MarkerSize', 25);
hold on
plot(1,-1, 'g.', 'MarkerSize', 25);
hold on
plot(-1,-1, 'g.', 'MarkerSize', 15);
hold on
plot(1,1, 'g.', 'MarkerSize', 15);
hold on
plot(-1,1, 'g.', 'MarkerSize', 15);
hold on
t=0;
for i = 1:numel(x)
Yprime = f(t,[x(i); y(i)]);
u(i) = Yprime(1);
v(i) = Yprime(2);
end
quiver(x,y,u,v,'r'); figure(gcf)
xlabel('y_1')
ylabel('y_2')
axis tight equal;