2
$\begingroup$
m1 = {{1, 0.2}, {0.5, 0.8}}
m2 = {{0.5, 0.9}, {0.7, 0.7}}
m3 = {{1.0, 0.2}, {-0.2, 1.0}}
m4 = {{-0.5, 1.0}, {0.5, 0.8}}

pt1 = {1, 1};
pt2 = {1, 0.5};
pt3 = {1.3, 0.7};
pt4 = {0.7, 1.3};

I have tried ParametricPlot, DiscretePlot, StreamPlot, VectorPlot and thought that VectorPlot would fit, but I guess there's a better way. 'Cause VectorPlot shows the vectors, not the real-line trajectories. I mean for each matrix, the trajectories will show how the points will go. So there should be 4 pictures separately.

Please help!

$\endgroup$
6
  • $\begingroup$ Could you clarify what the phase portrait of a matrix is? $\endgroup$
    – sebhofer
    Oct 13, 2017 at 8:39
  • $\begingroup$ I mean the phase portrait as a picturized set of trajectories, each made by a particular initial point. $\endgroup$
    – Alicia May
    Oct 13, 2017 at 8:47
  • $\begingroup$ Still not quite sure what you mean... something along these lines? $\endgroup$
    – sebhofer
    Oct 13, 2017 at 9:05
  • $\begingroup$ Yeah you are right. Do you think the picture that I added will work? $\endgroup$
    – Alicia May
    Oct 13, 2017 at 9:08
  • 1
    $\begingroup$ @J.M. It's 'DiscreteTime Models' from "A course in mathematical biology" that my Linear Algebra Professor provided us. $\endgroup$
    – Alicia May
    Oct 13, 2017 at 11:20

3 Answers 3

4
$\begingroup$

With my phase portrait package it would be done like this:

<< PhasePortrait`

Show[
 VectorPlot[m2.{x, y}, {x, -4, 4}, {y, -4, 4}],
 PhasePortrait[
  Thread[{x'[t], y'[t]} == m2.{x[t], y[t]}],
  {x, y}, t, {{-4, -4}, {4, 4}},
  GenerateInitialValues -> False,
  InitialValues -> {pt2},
  PlotStyle -> Green
  ]
 ]

Mathematica graphics

$\endgroup$
3
$\begingroup$

I believe you have several sets of trajectories and you want to plot them together.

Let's assume your trajectories are trj[1],.... You can use Arrow to plot them with Graphics.

Table[trj[n] = Table[t {Cos[2 Pi t + n], Sin[2 Pi t + n]}, {t, 0.2, 1.2, 0.05}]
                    , {n, 5}];

Graphics[{Arrowheads[{0, 0.05, 0.05, 0.05}], Table[Arrow[trj[n]], {n, 5}]}, Frame -> True]

enter image description here

I am not sure if this is what you want. If you can provide more details, I can modify my answer.

for your case, you can try

pts = {pt1, pt2, pt3, pt4};
ms = {m1, m2, m3, m4};

Do[{A[1], B[1]} = pts[[i]];
   trj[i] = Table[{A[n + 1], B[n + 1]} = ms[[i]].{A[n], B[n]}, {n, 100}], {i, 4}]

Graphics[{Arrowheads[{0, 0.05, 0.05, 0.05}], Table[Arrow[trj[i]], {i, 4}]}, 
          Frame -> True, PlotRange -> {{-20, 20}, {-20, 20}}]
$\endgroup$
2
  • $\begingroup$ The picture looks like it is what I want to mimic.... Thanks. Though, all I need is one variable 'n'. For example, {A(n+1), B(n+1)}=m1.{A(n), B(n)} where {A(1),B(1)}={1,1} (something like this). With this information, what I want to demonstrate is one axis with A(n) and the other with B(n) just like cosine and sine on your instance. $\endgroup$
    – Alicia May
    Oct 13, 2017 at 9:14
  • $\begingroup$ Your answer really helped me much $\endgroup$
    – Alicia May
    Oct 13, 2017 at 11:18
3
$\begingroup$

See also: Related Q/A - 77299

You can try the option StreamPoints with VectorPlot:

VectorPlot[m2.{x, y}, {x, -4, 4}, {y, -4, 4}, 
 StreamPoints -> {{{pt2, Directive[Thick, Green]}}, Automatic}]

enter image description here

For all four pairs of matrices and points:

data = Transpose[{{m1, m2, m3, m4}, {pt1, pt2, pt3, pt4}, {Red, Green, Blue, Orange}}];

Row[VectorPlot[#.{x, y}, {x, -4, 4}, {y, -4, 4}, 
    StreamPoints -> {{{#2, Directive[Thick, #3]}}, Automatic}, ImageSize -> 250] & @@@ data]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you so much!! $\endgroup$
    – Alicia May
    Oct 13, 2017 at 11:18
  • $\begingroup$ @Aliicia, my pleasure. Welcome to mma.se. $\endgroup$
    – kglr
    Oct 13, 2017 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.