[Scilab-users] vectorization issue

paul.carrico at free.fr paul.carrico at free.fr
Thu Jun 16 22:16:42 CEST 2016


Dear, 

I failed in using 100% vectorization in the following example (and I don't remember how to proceed) ; I spent a lot of time in testing things ... 


... what is the correct sentence for vecteur2 


Thanks for the help 


Paul 


###################################################################################### 
mode ( 0 ) t = 0 : 0.1 : %pi ; [ l , n ] = size ( t ) ; mat_sin = [ t ' sin ( t ' ) ] ; 
scalaire = intsplin ( mat_sin ( : , 1 ) , mat_sin ( : , 2 ) ) ; // with a loop vecteur = zeros ( n - 1 , 2 ) ; for j = 2 : n vecteur ( j - 1 , : ) = [ mat_sin ( j - 1 , 1 ) intsplin ( mat_sin ( [ 1 : j ] , 1 ) , mat_sin ( [ 1 : j ] , 2 ) ) ] ; end plot2d ( vecteur ( : , 1 ) , vecteur ( : , 2 ) ) pause // pure vectorisation i = [ 1 : n ] ' j = [ 2 : n ] ' vecteur2 = zeros ( n - 1 , 2 ) ; vecteur2 = [ mat_sin ( i , 1 ) intsplin ( mat_sin ( [ 1 : j ] , 1 ) , mat_sin ( [ 1 : j ] , 2 ) ) ] 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160616/ce2e8197/attachment.htm>


More information about the users mailing list