1

I have the following system of differential equations

x[t]' = 5 x[t] - y[t]
y[t]' = 3 y[t]

and I know how to get general the solution of the system for x[t] and y[t], but I need to get the plot of the gradient of the system and show it along with the particular solutions so they obey the plot of the gradient.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257

1 Answers1

3

Something like this?

eq1 = x'[t] == 5*x[t] - y[t];

eq2 = y'[t] == 3*y[t];

sol[x0_?NumericQ] := 
 First@NDSolve[{eq1, eq2, x[0] == x0, y[0] == x0}, {x, y}, {t, -3, 3}]

pp = ParametricPlot[
  Evaluate[{x[t], y[t]} /. sol[#] & /@ Range[-20, 20, 1]], {t, -3, 3},
   PlotRange -> {{-5, 5}, {-5, 5}}]

sp = StreamPlot[{5*x - y, 3*y}, {x, -5, 5}, {y, -5, 5}]

Show[pp, sp]

enter image description here

zhk
  • 11,939
  • 1
  • 22
  • 38