Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Vipin
Posts:
3
Registered:
4/27/11


Vectorization/ Speedup
Posted:
Mar 7, 2013 11:49 PM


If someone can answer my question I will be deeply indebted. I am trying to generate points of a face milling cutter edge with three cutting edges for three rotations. I have the cutting edge generated and is called cutptsy1 here.
I would like to speed up the code with vectorization.. my problem is that the number of rotations I will need are in the order of 2000, each rotation is taking 10 seconds to run, so now I am looking at 5.5 hours of run time.
Anyone has any comments about how to vectorize this?
rotpts1=zeros(20000000,4); rotpts2=zeros(20000000,4); rotpts3=zeros(20000000,4); %Adding cutter rotation points
for theta= 0:1:3*360 for counter2=1:size(cutptsy1,1) rotpts1(counter,1)= 0.5*3*theta*(pi/180)*0.5/pi+cutptsy1(counter2,1)*cosd(theta); rotpts1(counter,2)= cutptsy1(counter2,1)*sind(theta); rotpts1(counter,3)= cutptsy1(counter2,3); rotpts2(counter,1)= 0.5*3*theta*(pi/180)*0.5/pi+cutptsy1(counter2,1)*cosd(theta120); rotpts2(counter,2)= cutptsy1(counter2,1)*sind(theta120); rotpts2(counter,3)= cutptsy1(counter2,3); rotpts3(counter,1)= 0.5*3*theta*(pi/180)*0.5/pi+cutptsy1(counter2,1)*cosd(theta240); rotpts3(counter,2)= cutptsy1(counter2,1)*sind(theta240); rotpts3(counter,3)= cutptsy1(counter2,3); counter=counter+1; end end



