help-octave
[Top][All Lists]
Advanced

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

Vectorizing code array modulo indexing


From: Torbjörn Rathsman
Subject: Vectorizing code array modulo indexing
Date: Tue, 02 Oct 2012 21:00:09 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

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.


reply via email to

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