From: Selvaraaju on 29 Mar 2010 07:09 What is the easiest way to generate alternate +1 & -1 sequence? like if N= 5 1 -1 1 -1 1 so on..
From: us on 29 Mar 2010 07:15 On Mar 29, 1:09 pm, "Selvaraaju " <mselvara...(a)gmail.com> wrote: > What is the easiest way to generate alternate +1 & -1 sequence? > > like if N= 5 > > 1 -1 1 -1 1 > > so on.. one of the many solutions nr=5; r=sign(round(rand(1,nr))-.5); us
From: Selvaraaju on 29 Mar 2010 07:25 us <us(a)neurol.unizh.ch> wrote in message <2050b661-4658-4c0c-b9ca-da42c6887ecb(a)g28g2000yqh.googlegroups.com>... > On Mar 29, 1:09 pm, "Selvaraaju " <mselvara...(a)gmail.com> wrote: > > What is the easiest way to generate alternate +1 & -1 sequence? > > > > like if N= 5 > > > > 1 -1 1 -1 1 > > > > so on.. > > one of the many solutions > > nr=5; > r=sign(round(rand(1,nr))-.5); > > us How could you use rand function to generate a determinstic sequence? Try running that code twice and you will get different results. If N = 3 then 1 -1 1 if N= 4 then 1 -1 1 -1 I hope that you understand the problem
From: Selvaraaju on 29 Mar 2010 07:29 us <us(a)neurol.unizh.ch> wrote in message <2050b661-4658-4c0c-b9ca-da42c6887ecb(a)g28g2000yqh.googlegroups.com>... > On Mar 29, 1:09 pm, "Selvaraaju " <mselvara...(a)gmail.com> wrote: > > What is the easiest way to generate alternate +1 & -1 sequence? > > > > like if N= 5 > > > > 1 -1 1 -1 1 > > > > so on.. > > one of the many solutions > > nr=5; > r=sign(round(rand(1,nr))-.5); > > us How could you use rand function to generate a determinstic sequence? If N= 4 then 1 -1 1 -1 If N= 3 then 1 -1 1 if N= 10 then 1 -1 .... 1 I hope you understood the problem Your code gives different results for execution
From: David Young on 29 Mar 2010 07:32 It's alternating, not random. One solution, unlikely to be the neatest to be found: nr = 5; a = (1:2:2*nr-1) - 4*(floor((1:nr)/2))
|
Next
|
Last
Pages: 1 2 3 Prev: usb camera dll not recognised as valid adaptor Next: complex signal correlation |