Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

According to the code given change the system ODE to the following to plot the t

ID: 3796955 • Letter: A

Question

According to the code given change the system ODE to the following to plot the trajectories.

system1:

x' = -x-y

y' = 2x - (2/3)y

system 2:

x''+(4/t)x'+(2/t^2)x = 0

$Sample script for plotting trajectories of a system using quiver clear all; close all; [x1,x2] meshgrid (-1: 0.1:1 1:0. 1:1) xdl zeros (size (x1)); xd2 zeros (size (x2) for i 1:20 for j 1:20 xdot sys (0, (x1 (i, j) x2 (i, j) xd1 (i, j) xdot (1) xd2 (i,j) xdot (2) end end figure (1); quiver (x1, x2,xd1,xd2) xlabel ('x1') ylabel ('x2'); title ('Direction field trajectories of a given system grid on & Function to define the differential equations is given below: function xdot sys (t,x) xdot. C-4 x (1) -8 x (2) -2*x (2) end

Explanation / Answer

clear all;
close all;
[x1,x2] = meshgrid(-1:0.1:1,-1:0.1:1);

xd1 = zeros(size(x1));
xd2 = zeros(size(x2));
for i=1:20
   for j=1:20
       xdot = sys(0,[x1(i,j);x2(i,j) ]);
       xd1(i,j) = xdot(1);
       xd2(i,j) = xdot(2);
   end
end
figure(1);
quiver(x1,x2,xd1,xd2);
xlabel('x1');
ylabel('x2');
title('Direction field trajectories of a given system')
grid on

%function to define differential equations
function xdot = sys(t,x)
   xdot = [-1*x(1) - 1*x(2);2*x(1)-(2/3)*x(2)]
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote