Re: Hi
- To: mathgroup at smc.vnet.net
- Subject: [mg116251] Re: Hi
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 8 Feb 2011 05:07:14 -0500 (EST)
On 2/7/11 at 6:05 AM, isableng at gmail.com (Isabella Blengini) wrote:
>Hi I have a problem. I created a column vector of 100 rows, let's
>say a[100,1]. Each row corresponds to the value of my function in
>each unit of time. I would like to plot this vector. I should get a
>function that has a value a(1,1) at time 1, a(2,1) at time 2 and so
>on... Any suggestions???
To start, try actually creating what Mathematica recognizes as a
vector. Note
In[1]:= test = Array[a, 10]
Out[1]= {a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10]}
In[2]:= VectorQ[a]
Out[2]= False
In[3]:= VectorQ[test]
Out[3]= True
In Mathematica, the syntax a[100,1] is interpreted as the
function a evaluated with arguments 100 and 1. It is definitely
not a vector as the above demonstrates.
VectorQ[expr] returns true whenever expr is a one-dimensional
list. And when VectorQ[expr] is true, you can plot expr using
ListPlot. For example the following will plot the sin function
for one cycle
test = Sin[Range[100]*(Pi/50)];
ListPlot[test]