The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Vectorization/ Speedup
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 3
Registered: 4/27/11
Vectorization/ Speedup
Posted: Mar 7, 2013 11:47 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?

%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);



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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.