help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vectorizing code array modulo indexing


From: Juan Pablo Carbajal
Subject: Re: Vectorizing code array modulo indexing
Date: Tue, 2 Oct 2012 22:12:25 +0200

On Tue, Oct 2, 2012 at 9:00 PM, Torbjörn Rathsman
<address@hidden> wrote:
> Is this kind of thing possible to do without do it in a loop?
>
>     notes=[1 1 0 1 1 1 0 1 1 0 1 0]';
>     x=12.*log(f./440)./log(2);
>     spectrum=spectrum.*cos(pi.*x).^16.* notes( mod(round(x),12) + 1 );
>
> f is a vector of 10^7 elements and I want to take each computed index and
> generate corresponding value from notes.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

Can you give more details? I do not see a loop.
I see that you are multiplying spectrum by something and then saving
it back into spectrum. What is the initial value of spectrum.

Sorry for not understanding.


-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]