I need your help to how change the following Matlab code to plot the vector field as soon as the figure attached (I need plot the Vectors are identical in length) .

%%%%%%%%%%%%%%%%%%%%%%

clear;

sys = @(t,x) [2*x(1)+x(2);x(1)-2*x(2)];

vectfield(sys,-3:0.25:3,-3:0.25:3);

hold on

for x0=-3:1.5:3

for y0=-0.1:1.5:3

[ts,xs]=ode45(sys,[0 5],[x0 y0]);

plot(xs(:,1),xs(:,2));

end

end

for x0=-3:1.5:3

for y0=-3:1.5:3

[ts,xs]=ode45(sys,[0 -5],[x0 y0]);

plot(xs(:,1),xs(:,2));

end

end

hold off

fsize=15;

set(gca,'xtick',[-3:1:3],'FontSize',fsize)

set(gca,'ytick',[-3:1:3],'FontSize',fsize)

xlabel('x(t)','FontSize',fsize) ;

ylabel('y(t)','FontSize',fsize) ;

hold off

%%%%%%%%%%%%%%%

Similar questions and discussions