[Scilab-users] Vectorization : how to proceed
Paul Carrico
paul.carrico at free.fr
Tue Nov 20 17:28:19 CET 2012
Finally I think Ive found how to proceed .. at the same time I think I
understood the use of the dot . (see after the cos)
Paul
###################################################
function vect_fct=fct_angles(i, j)
vect_fct3 = [ (cos(i). * sin(j) ) (-sin(j)) i j];
endfunction
B = zeros(130321,4);
theta_vect = (0:360)'.*.ones(361,1);
fi_vect = (ones(361,1)'.*.[0:360])';
B = fct_angles3(theta_vect([1:130321],1),fi_vect([1:130321],1));
De : users-bounces at lists.scilab.org [mailto:users-bounces at lists.scilab.org]
De la part de Paul Carrico
Envoyé : mardi 20 novembre 2012 14:34
À : 'International users mailing list for Scilab.'
Objet : [Scilab-users] Vectorization : how to proceed
Dear All
In the above example, how can I proceed to perform the product (see function
fct_angles2) ?
Indeed, theta are 2 vectors, so no problem for the fct_angles
but in case
of product, its naturally not work !!! what is the correct syntax in order
to use vectorization ?
Thanks
Paul
######################################################
mode(0)
function vect_fct=fct_angles(i, j)
vect_fct = [cos(i)+sin(j) -sin(j) i j];
endfunction
function vect_fct2=fct_angles2(i, j)
vect_fct = [cos(i)*sin(j) -sin(j) i j];
endfunction
B1 = zeros(130321,4);
theta_vect = (0:360)'.*.ones(361,1);
fi_vect = (ones(361,1)'.*.[0:360])';
B1 = fct_angles(theta_vect([1:130321],1),fi_vect([1:130321],1));
B2 = fct_angles2(theta_vect([1:130321],1),fi_vect([1:130321],1));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121120/de01fed9/attachment.htm>
More information about the users
mailing list