Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Vectorization/ Speedup
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Vipin

Posts: 3
Registered: 4/27/11
Vectorization/ Speedup
Posted: Mar 7, 2013 11:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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(theta-120);
rotpts2(counter,2)= cutptsy1(counter2,1)*sind(theta-120);
rotpts2(counter,3)= cutptsy1(counter2,3);

rotpts3(counter,1)= 0.5*3*theta*(pi/180)*0.5/pi+cutptsy1(counter2,1)*cosd(theta-240);
rotpts3(counter,2)= cutptsy1(counter2,1)*sind(theta-240);
rotpts3(counter,3)= cutptsy1(counter2,3);

counter=counter+1;

end
end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.