Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Hi there, mathematicians.

I'm not very good at coding plots in Mathematica, so I was hoping that one of you could help me solve a problem I'm having.

I have the following matrix plot:

Z = {Subscript[x, 0], Subscript[x, 1], Subscript[x, 2]}
X = {{0, 8, 12}, {.1, 0, 0}, {0, .2, 0}}

Then I put it in a function as follows:

P[x_] := X^x.Z

I would like Mathematica to display plots such that, whenever x iterates from 1 to 10 in the function, the x1, x2, and x3 from the matrix are respectively plotted in three plots. Can anyone help me?


EDIT: Trying to be more clear

I have the matrix (mat) and the vector (v):

mat = {{0, 8, 12}, {.1, 0, 0}, {0, .2, 0}}
v = {x0, x1, x2}

Then later I define the function for population development, pD, taking t (for time in days) as its only parameter.

pD[t] = mat^t.v

Now I would like to show the development of the variables $x_1$,$x_2$, and $x_3$ assuming the values 30, 60, 30, respectively. I would do so by making plots of the three functions over the range 1 to 10 days. For each the first plot should display the values of $\{t,pD[t_{x_1}]\}$, the second the values of $\{t,pD[t_{x_2}]\}$, and the third the values of $\{t,pD[t_{x_3}]\}$. I hope this clarifies my question. Sorry for being so unconventional in the first place. However, having worked my eyes blind for quite some time, I presumed that it was anything but difficult to understand. Thanks for your patience!


Best regards, Brinck10

share|improve this question
    
Let us assume that x_0, x_1, and x_2 are respectively 30, 60, 30. Then I would like to plot three graphs, one graph representing each x, for each iteration of x in P[x]. Thanks in advance. –  Frederik Brinck Jensen Dec 12 '12 at 19:27

2 Answers 2

up vote 0 down vote accepted

Assuming you want mat^t to mean the matrix power, one way to plot the three elements of the output is to make a table of the values and then ListPlot them:

 pD[t_] := MatrixPower[mat, t].{30, 60, 30};
 ListLinePlot[Transpose[Table[pD[t], {t, 1, 10, 1}]]]
share|improve this answer

I am posting this, just to have something to use to try to converge to an answer. Since I am not sure I still understand the question.

This just plots a vector in 3D. i.e a line from $(0,0,0)$ to the another point in 3D space. The other point is the result of doing $mat^n.vec$. where mat matrix and vec is vector. And the question asked to plot this for each $n$

I have a feeling I am missing something here. But at least now we have something to change to try to find out what is actually needed :)

Manipulate[
 Module[{vec, mat, pt},
  vec = {30, 60, 30};
  mat = {{0, 8, 12}, {.1, 0, 0}, {0, .2, 0}};
  pt = p[n, mat, vec];

  Graphics3D[
   {Thick, Line[{{0, 0, 0}, p[n, mat, vec]}]}, Axes -> True
   ]

  ],

 {{n, 2, "n="}, 1, 10, 1},
 Initialization :>
  (
   p[n_, mat_, vec_] := mat^n.vec
   )
 ]
share|improve this answer
    
@Nasser-m-abbasi see my edit. Thanks for your trouble :) –  Frederik Brinck Jensen Dec 12 '12 at 20:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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