MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: create a list with x,y,z coordinates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81659] Re: create a list with x,y,z coordinates
  • From: "sdw" <warwick at jps.net>
  • Date: Mon, 1 Oct 2007 04:40:08 -0400 (EDT)
  • References: <fdf2ol$2i7$1@smc.vnet.net> <fdi6nn$rpi$1@smc.vnet.net>

this works


xy = Flatten[

            Table[{i, j}, {i, 0.05, 1, 0.1}, {j, 0.05, 1, 0.1}]

                   ,1 ]    (* need to create simple list of xy points *)

zvals = {13, 8, 15, 9, 15, 8, 11, 2, 18, 8, 5, 10, 11, 10, 9, 14, 6, 23, 6,
14, 16, 5, 10, 5, 18, 10, 11, 10, 15, 8, 6, 23, 6, 17, 6, 12, 9, 17, 4, 8,
18, 4, 18, 9, 13, 9, 14, 6, 10, 6, 5, 13, 5, 10, 6, 19, 8, 17, 9, 16, 15,
5, 13, 5, 11, 9, 16, 2, 21, 11, 4, 15, 7, 10, 7, 16, 10, 14, 7, 18, 17, 8,
15, 11, 14, 5, 14, 4, 13, 6, 8, 16, 8, 22, 8, 6, 9, 13, 5, 12};

MapThread[ Append[#1, #2] &, {fxy, zvals}]  (* simply run through and add 
zvals to end.. *)









<michael.p.croucher at googlemail.com> wrote in message 
news:fdi6nn$rpi$1 at smc.vnet.net...
> On 27 Sep, 02:58, Claus <claus.hasla... at web.de> wrote:
>> Hi,
>> I have a list of z-values:
>>
>> zVals={13, 8, 15, 9, 15, 8, 11, 2, 18, 8, 5, 10, 11, 10, 9, 14, 6, 23,
>> 6, 14, 16, 5, 10, 5, 18, 10, 11, 10, 15, 8, 6, 23, 6, 17, 6, 12, 9, 17,
>> 4, 8, 18, 4, 18, 9, 13, 9, 14, 6, 10, 6, 5, 13, 5, 10, 6, 19, 8, 17, 9,
>> 16, 15, 5, 13, 5, 11, 9, 16, 2, 21, 11, 4, 15, 7, 10, 7, 16, 10, 14, 7,
>> 18, 17, 8, 15, 11, 14, 5, 14, 4, 13, 6, 8, 16, 8, 22, 8, 6, 9, 13, 5, 12}
>>
>> These z-values are at grid points in a regularly spaced mesh, indices i
>> and j correspond to coordinates x and y, respectively. I can create the
>> mesh by
>>
>> Table[{i,j},{i,0.05,1,0.1},{j,0.05,1,0.1}]
>>
>> What is the best way in mathematica to "append" the z-values to the
>> (x,y)values?
>> I know that they are in order corresponding to the (x,y)values; that is
>> 13 corresponds to (0.05,0.05) and 12 corresponds to (0.95,0.95).
>>
>> Thanks for your help,
>> Claus
>
> I don't know if this is the 'best' way but it seems to work.  Is this
> what you want?
>
> xy = Table[{i, j}, {i, 0.05, 1, 0.1}, {j, 0.05, 1, 0.1}];
>
> zvals = {13, 8, 15, 9, 15, 8, 11, 2, 18, 8, 5, 10, 11, 10, 9, 14, 6,
>   23, 6, 14, 16, 5, 10, 5, 18, 10, 11, 10, 15, 8, 6, 23, 6, 17, 6,
>   12, 9, 17, 4, 8, 18, 4, 18, 9, 13, 9, 14, 6, 10, 6, 5, 13, 5, 10,
>   6, 19, 8, 17, 9, 16, 15, 5, 13, 5, 11, 9, 16, 2, 21, 11, 4, 15, 7,
>   10, 7, 16, 10, 14, 7, 18, 17, 8, 15, 11, 14, 5, 14, 4, 13, 6, 8,
>   16, 8, 22, 8, 6, 9, 13, 5, 12};
>
> xyz=Partition[Riffle[Flatten[xy], zvals, {3, -1, 3}], 3];
>
> 




  • Prev by Date: Re: Plot3D with NDSolve
  • Next by Date: Re: Problem with lists as matrices for OLS and statistical inference
  • Previous by thread: RE: Plot3D with NDSolve
  • Next by thread: Re: create a list with x,y,z coordinates