From: Jan Simon on 29 Mar 2010 18:45 Dear Selvaraaju! > like if N= 5 > 1 -1 1 -1 1 Next method: pool = [-1, 1]; v = pool(mod(1:N, 2) + 1) Good luck, Jan
From: Matt Fig on 29 Mar 2010 19:00 Might be faster than indexing (?). mod(1:5,2)*2 - 1
From: Walter Roberson on 29 Mar 2010 19:56 Jan Simon wrote: > Dear Selvaraaju! > >> like if N= 5 >> 1 -1 1 -1 1 > > Next method: > pool = [-1, 1]; > v = pool(mod(1:N, 2) + 1) v = mod(1:N,2) * 2 - 1; or v = ones(1,N); v(mod(0:N-1,2)) = -1; or v = ones(1,N); v(2:2:end) = -1;
From: James Tursa on 30 Mar 2010 02:10 How 'bout this one? round(cos(mod((0:N)*4*atan(exp(0)),sqrt(4)*acos(log(1/exp(1))))))
From: Jan Simon on 30 Mar 2010 14:56 Dear James! > How 'bout this one? > round(cos(mod((0:N)*4*atan(exp(0)),sqrt(4)*acos(log(1/exp(1)))))) You could solve SQRT(4) symbolically. And here: (0:N) * 4 * atan(exp(0)) additional brackets reduce the computational time: (0:N) * (4 * atan(exp(0))) Jan
First
|
Prev
|
Pages: 1 2 3 Prev: usb camera dll not recognised as valid adaptor Next: complex signal correlation |