Great. Thanks. Should have thought of it myself... Still: is there a vector way? Heinz
> On 07.11.2018, at 21:06, kjubo <[email protected]> wrote: > > > > Hello, > > precalculate the know values, I gain 40% faster execution time. > Hope helps a bit... > > BR > > clc, clear, mode(0) > > n=1e6 > Z=grand(1,n,'nor',0,1); > Z=Z(:); > r=0.9; > > tic() > V1=Z; > for ii=2:n; > V1(ii)=r*V1(ii-1)+sqrt(1-r^2)*Z(ii); > end; > toc() > > tic() > V2 = Z; > k1 = sqrt(1-r^2).*Z; > for ii=2:n; > V2(ii) = r*V2(ii-1) + k1(ii); > end; > toc() > > isequal(V1,V2) _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
