# Matrix Plot – Little Exercise

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

-
please do not start your variables and symbols and function names with UpperCase letter. start everything with lowerCase. UpperCase first letter is meant to be used by Mathematica only. – Nasser Dec 12 '12 at 18:51
You do not have numerical values for your z vector. So how can one plot anything here? i.e. your {Subscript[x, 0], Subscript[x, 1], Subscript[x, 2]} is just symbolic. Can you please explain more the problem using normal math? i.e. what are the values of $x_0$ , $x_1$ and $x_2$? thanks – Nasser Dec 12 '12 at 19:00
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
You are really overloading $x$ in so many places so I am confused. You have matrix which you called $X$ and then you have $x_i$ and using $x$ inside P. But aside from this. $X^n . Z$ gives one vector. So as $n$ changes from $1$ to $10$, one vector is generated. So you want to plot just a line for each $n$? btw, I wish you name your variables to mean more what they are. i.e. rename $X$ to be mat and $Z$ to become vec and rename your function P[x_]:= X^x.Z to be p[n_]:=(mat^n).vec so things become more clear. Using good names for things makes the code more understandable. – Nasser Dec 12 '12 at 19:42

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}]]]

-

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
)
]

-
 @Nasser-m-abbasi see my edit. Thanks for your trouble :) – Frederik Brinck Jensen Dec 12 '12 at 20:28