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

MathGroup Archive 2007

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

Search the Archive

Re: Array reference help please

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73327] Re: [mg73295] Array reference help please
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Mon, 12 Feb 2007 05:05:19 -0500 (EST)
  • References: <200702100441.XAA08004@smc.vnet.net>

decayTerm[time_,decayParameter_,amplitude_,startTime_]=
  With[{elapsedTime=t-startTime},
    amplitude*UnitStep[elapsedTime]*Exp[decayParameter*elapsedTime]]

plotFun[t_]=Total@Apply[decayTerm[t,-100,##]&,Table[Random[],{40},{2}],{1}];

Plot[Evaluate@plotFun@t,{t,0,1}]

??

On 2/9/07, rob <robIV at piovere.com> wrote:
> I've managed to get this code working but I'm stumped on a
> good way to refer to the entries in the data when plotting.
> The only thing I can get to work is to refer to the first of
> each pair as Part[data[[i]],1] and the second as
> Part[data[[i]],2].
>
> And more humiliating, the second one I have to spell out
> twice. I tried all kinds of substitutions but failed. I know
> you gurus here know how to make this code look better and
> run more quickly. Thanks for your time.
>
>
>
> á=100;(* decay parameter*)
>
> (* first parameter is pulse amplitude, second is time of
> occurrence - later to follow Poisson *)
>
> data=Table[Random[],{40},{2}];
>
> li=Length[data];
>
> Plot[Sum[
>          Part[data[[i]],1]  UnitStep[t-Part[data[[i]],2]]
>          Exp[-á (t-Part[data[[i]],2])],  {i,li}
>          ]
>    ,{t,0,1}]
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: Curve-fitting/data analysis question...
  • Next by Date: Re: Eigensystem
  • Previous by thread: Re: Array reference help please
  • Next by thread: Re: Array reference help please