Using i and j as variables in MATLAB

Because i and j are both functions denoting the imaginary unit:

  • http://www.mathworks.co.uk/help/matlab/ref/i.html
  • http://www.mathworks.co.uk/help/matlab/ref/j.html

So a variable called i or j will override them, potentially silently breaking code that does complex maths.

Possible solutions include using ii and jj as loop variables instead, or using 1i whenever i is required to represent the imaginary unit.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)