I am executing an m-file using Matlab 2014b. Let's call it my_m_file. During the execution I am getting the following warning:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.277288e-17. > In viaMtimes at 35 In my_m_file at 35
I understand the warning and at line 35 in the file viaMtimes one has: "Z = inv(Z);". It is true that at several points in my code I am raising a matrix to the power -1 and I understand that on one such occasion the matrix is close to singular so the inversion is problematic.
Normally the last part of the message "In my_m_file at 35" would point out to the line in my m file where the problem lies. But this is where it gets strange. On line 35 of the file I am actually declaring a new variable as M = NaN(T,N) where T and N have been previously defined. What causes Matlab to point to the wrong line and how can I fix this?