help-octave
[Top][All Lists]
Advanced

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

Re: help with vectorizing a for loop


From: Martin Helm
Subject: Re: help with vectorizing a for loop
Date: Mon, 03 Oct 2011 13:42:17 +0200

Am Montag, den 03.10.2011, 00:09 -1000 schrieb Rick T:
> Greetings All
> 
> 
> I have a for loop that reads an array but I would like to vectorize it
> to see if will improve speed. at the moment the for loop takes about 7
> mins any ideas to speed this up
> 
> 
> The array called inner_freq has three columns made up of
> amplitude,frequency, and phase
> 
> 
> for ii=1:1:length(inner_freq)-1
> 
>  
> aa_sig_rebuilt=inner_freq(ii,2)*cos(2*pi*t*inner_freq(ii,1)+inner_freq(ii,3));
>      aa_sig_combined=aa_sig_combined+aa_sig_rebuilt;
> end;
> 
> 
> thanks

This is just out of my head and not tested:

aa_sig_combined=sum(inner_freq(1:end-1,2).*cos(2.*pi.*t.*inner_freq(1:end-1,1).+inner_freq(1:end-1,3)))




reply via email to

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