Vincent Cheung

Vincent Cheung's Blog


« Newer Post Home Older Post »

Friday, April 30, 2004

Matlab "for" loops.

The indices for Matlab "for" loops can be made quite cleverly, eg. for ii = round(xMin : (xMax-xMin+1)/10 : xMax). This gives 10 ii's, evenly spaced between xMin and xMax inclusive, and also rounds the ii's to the nearest integer.

On another note, it's not a good idea to use i or j as indices for "for" loops because i^2 = j^2 = -1 :D. I got caught on that before....why aren't my complex numbers complex!!!!

0 Comments:

Post a Comment