Re: Array reference help please
- To: mathgroup at smc.vnet.net
- Subject: [mg73337] Re: Array reference help please
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 13 Feb 2007 06:53:47 -0500 (EST)
- Organization: Uni Leipzig
- References: <eqjiid$7te$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
and something like
Plot[Evaluate[
#[[1]]*UnitStep[t-#[[2]]]*Exp[-lambda*(t-#[[2]])] & /@ data
],{t,0,1}]
does not help ??
Regards
Jens
rob 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.
>
>
>
> =CE=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[-=CE=B1 (t-Part[data[[i]],2])], {i,li}
> ]
> ,{t,0,1}]
>