Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: time series

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46407] Re: time series
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 16 Feb 2004 23:43:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 2/16/04 at 9:00 AM, tarpanelli at libero.it (paolo tarpanelli)
wrote:

>Given a time series x={a1,a2,a3,a4,a5,a6,...,an}

>how can i divide it in different segments x1, x2,..., xn

>x1={a1,a2,a3} x2={a4,a5,a6} .... xn={an-2,an-1,an}

Try

x=Table[Random[],{12}];
variables=Table[ToExpression["x"<>ToString@n],{n,4}];
MapThread[Set[#1,#2]&,{variables,Partition[x,3]}];
x1

{0.543968,0.431695,0.106827}

The first line defines x to be a vector with 12 random reals

The second line defines variables to be a vector with 4 elements x1 through x4

The third line splits x into segments (Partition) and sets each group of three to the symbols contained in variables.

And the last line simply prints the values assigned to x1
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: No Output, No Error
  • Next by Date: Re: No Output, No Error
  • Previous by thread: RE: time series
  • Next by thread: No Output, No Error