MathGroup Archive 2004

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

Search the Archive

Re: message 50001?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50026] Re: [mg50001] message 50001?
  • From: János <janos.lobb at yale.edu>
  • Date: Thu, 12 Aug 2004 05:43:39 -0400 (EDT)
  • References: <200408110952.FAA04080@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Well, here are some non-wizard thoughts.

In[1]:=
S=Table[Random[Real,{1.0,10.0}],{100}]

Out[1]=
{6.27376,8.81914,2.55218,8.89693,8.2644,1.25336,8.88699,1.89446,4.66345, 
7.\
76707,9.81439,3.19439,3.73039,9.24544,9.41634,4.03454,7.33064,4.4974,5.0 
9137,\
3.29398,4.91963,3.18602,3.12096,9.25284,8.64587,4.36687,1.56879,1.35591, 
1.\
38148,4.11351,2.6818,9.46145,6.71803,6.34644,2.86741,7.26706,3.98764,7.1 
0101,\
3.45107,4.23252,6.657,3.60361,8.3597,1.93854,2.73737,1.41759,6.23873,2.6 
857,4.\
09149,7.05072,5.66995,2.32979,3.71002,3.93721,3.98815,2.86834,6.99198,7. 
59076,\
2.12074,5.60128,4.00434,1.48975,8.66967,2.36875,7.34734,7.88614,1.30997, 
1.\
43021,5.60997,7.46855,5.07124,8.74452,2.51848,1.41783,9.4013,7.41473,8.8 
0846,\
7.48062,6.41315,5.54639,2.81648,9.88986,5.29241,9.94512,8.81214,9.40011, 
6.\
62274,8.57636,2.46479,2.51396,6.31276,8.14615,6.85482,5.04541,2.24152,9. 
40163,\
5.33634,4.62758,2.84023,2.9869}

In[2]:=
Position[S,Max[S]]

Out[2]=
{{84}}

János
On Aug 11, 2004, at 5:52 AM, 1.156 wrote:

> Mathematica wizards, I've managed to cripple together code to do  
> something that
> I feel must be doable more easily and/or faster.
>
> S is a list of reals containing a signal with a prominent peak in
> amplitude. I simply want to find the index of the peak (x, the number  
> of
> entries into the list where the peak occurs). Here's what I did.
>
>
> For[i = 1, S[[i]] ? max[S], i++, x = i];
>
> Can some suggest a better way, especially one not using a For loop?
>
> Thanks, Rob
>
>
------------------------------------------------
``Our enemies are innovative and resourceful, and so are we. They never  
stop thinking about new ways to harm our country and our people, and  
neither do we.''       -- George W. Bush



  • Prev by Date: Re: message 50001?
  • Next by Date: Re: how to graphically fill the tails of a normal distribution
  • Previous by thread: Re: message 50001?
  • Next by thread: Re: message 50001?