       Re: Array reference help please

• To: mathgroup at smc.vnet.net
• Subject: [mg73315] Re: [mg73295] Array reference help please
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 11 Feb 2007 01:17:43 -0500 (EST)
• Reply-to: hanlonr at cox.net

```a=100;

data=Table[Random[],{40},{2}];

Plot[Total[data[[All,1]]*
(UnitStep[#]*Exp[-a*#]&/@
(t-data[[All,2]]))],
{t,0,1}];

Bob Hanlon

---- 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.
>
>
>
> =C3=8E=C2=B1=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[-=C3=8E=C2=B1 (t-Part[data[[i]],2])],  {i,li}
>          ]
>    ,{t,0,1}]
>

```

• Prev by Date: Re: a function containg MeijerG (limit behavior)
• Next by Date: Re: Re: record intermediate steps
• Previous by thread: Re: Array reference help please
• Next by thread: Re: Array reference help please