Results 1 to 2 of 2

Math Help - Creating and plotting multiple lists

  1. #1
    Newbie
    Joined
    Sep 2008
    Posts
    9

    Creating and plotting multiple lists

    I have a list of length N. I would now like to create N lists. Each of these lists will be the Y coordinate of a plot. Something like the following:

    Code:
    For[p=1,p<=N,p++, Y[p] = Table[0, {i, ndof/2}];
    	x = 1; j = 1; t = 2;
    	For[i = 1, i <= Length[Y[1]], i++,
     		If[DOFSupports[[j]] == x,
                          Y[p][[i]] = 0; j = j + 1, 
                          Y[p][[i]] = \[Phi][[sigmodes[[1]], t]]; t = t + 3]; 
             x = x + 2]
    The problem is Y[p][[i]] will not work.

    Also, I would then like to plot each Y[p] with a loop that would plot each:

    Code:
    ListLinePlot[{Y}, DataRange -> {0, X[[ndof/2]]}, 
     PlotRange -> {-0.8, 0.8}]
    Any help would be appreciated. I am sure it will have something to do w/ setting up functions...which I haven't quite grasped well yet. Thank you.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    I don't quite follow your code. However, why not just set up a double array with the list of points for each plot as the columns and the rows, the plots. Also, a double array is specified as a[[i,k]]. Maybe that would help you. Here's some example. The datapoint array gives the number of points for each plot. I next just generate some straight line data "xn" for each plot having the number of data points specified by the array datapoints. I then send that matrix to ListLinePlot. For example list[[2,3]]=4.


    Code:
    datapoints = {5, 8, 9, 10, 15};
    list = Table[x n, {n, 1, 5}, {x, 0, datapoints[[n]]}]
    ListLinePlot
    [list]
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Graphing Instructions Problem - Lists
    Posted in the Calculators Forum
    Replies: 0
    Last Post: July 30th 2011, 08:35 PM
  2. Plotting multiple circles in Octave from arrays
    Posted in the Math Software Forum
    Replies: 1
    Last Post: October 27th 2010, 08:43 PM
  3. 3-lists taken from [3]
    Posted in the Discrete Math Forum
    Replies: 5
    Last Post: May 18th 2010, 08:20 AM
  4. Mathematica: Lists
    Posted in the Math Software Forum
    Replies: 5
    Last Post: February 27th 2010, 02:19 PM
  5. Replies: 0
    Last Post: August 20th 2008, 01:58 PM

Search Tags


/mathhelpforum @mathhelpforum