0

I'm trying to understand the cosinor analysis in Matlab. http://www.mathworks.com/matlabcentral/fileexchange/20329-cosinor-analysis/content/html/cosinor.html

I'm not understanding the find() function, actually this line: IND = find(real(beta_s1) ~= real(beta_s2));

Can someone tell me why Matlab considers these values equal?

4.4115 + 2.0221i

4.4115 - 2.0221i

Thanks

KelvinS
  • 2,870
  • 8
  • 34
  • 67
  • 2
    The code line checks only the real part. So they're roughly the same. But probably they are [not exactly the same](http://stackoverflow.com/questions/686439/why-is-24-0000-not-equal-to-24-0000-in-matlab/686454#686454). Depending on application, it is usually very bad practice to compare floating-point numbers exactly. – Andras Deak -- Слава Україні Feb 19 '16 at 13:21
  • Ok, I understood, thanks a lot. – KelvinS Feb 19 '16 at 22:12

0 Answers0