Question

Draw a direction field using MATLAB to sketch a few of the trajectories, and describe the...

Draw a direction field using MATLAB to sketch a few of the trajectories, and describe the behavior of the solutions as t → ∞

x' = [ 1 -1 ]

[ 5 -3 ] x

It's a matrix, sorry its bad, so x' = [ ] *x

I just do not know how to put this in Matlab, thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab code for the problem

clc; clear; % Clearing the command window and workspace

[x,y] = meshgrid(-5:0.2:5); % Creating mesh grid of the domain

% Rewritting the matrix equation as system of equations ie, x = [x, y]' and

% dx/dt = [u, v]';

u = x-y; % dx/dt = x-y

v = 5*x-3*y; % dy/dt = 5x-3y

quiver(x,y,u,v); % plotting the vector field

hold on; % holding the figure to plot solutions

% To understand the nature of the solution plotting some solution to the

% ODE

t = [0 50]; %Time period

f = @(t,y) [y(1)-y(2); 5*y(1)-3*y(2)]; % The RHS of ODEs

initial = [3 1]; % Initial condition

[t,Y] = ode45(f,t,initial); %Computing the solution using ODE45 function

plot(Y(:,1),Y(:,2)); % plotting the solution for the initial condition [x, y] = [3 1]

initial = [-3 1]; % Initial condition

[t,Y] = ode45(f,t,initial); %Computing the solution using ODE45 function

plot(Y(:,1),Y(:,2)); % plotting the solution for the initial condition [x, y] = [-3 1]

initial = [-3 -1]; % Initial condition

[t,Y] = ode45(f,t,initial); %Computing the solution using ODE45 function

plot(Y(:,1),Y(:,2)); % plotting the solution for the initial condition [x, y] = [-3 -1]

initial = [3 -1]; % Initial condition

[t,Y] = ode45(f,t,initial); %Computing the solution using ODE45 function

plot(Y(:,1),Y(:,2)); % plotting the solution for the initial condition [x, y] = [3 -1]

xlabel('x'),ylabel('y'); % labeling the axis

Screen Print of the code

1 2 3 4 clc; clear; % Clearing the command window and workspace [x,y] = meshgrid(-5:0.2:5); % Creating mesh grid of the domai

Screen Print of the output

Figure 1 + 9 2 у 2. 4 -6 -6 -2 2 6 х

Solution tends to zero as t tends to infinity.

Add a comment
Know the answer?
Add Answer to:
Draw a direction field using MATLAB to sketch a few of the trajectories, and describe the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT