An open exchange for the MATLAB and Simulink user community |
Hosted by The MathWorks |
|
| Related Topics |
| New Products | Support | Documentation | Training | Webinars | Jobs | Newsletters |
| Problems? Suggestions? Contact us at files@mathworks.com | © 1994-2008 The MathWorks, Inc. Trademarks Privacy Policy |
I long ago got in the habit of eliminating sqrt’s from distance computations whenever possible, since the sqrt usually takes longer than computing the square of the distance. In this case, I would compare the sum of squares with r^2.
Martin,
This is an excellent observation. I am thinking of adding another video in this series that might be able to fit in code optimizations like that.
Thank you,
Doug