MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

 Subject: @\$%#^%*\$&#^\$&%!!!!! From: Petr Krysl Date: 22 Jun, 2012 01:08:07 Message: 1 of 3 K>> d d =   -0.0581   -0.0031    0.0245    0.0245   -0.0031 + 0.0000i   -0.0031 - 0.0000i    0.0214    0.0214    0.0214   -0.1132   -0.1132   -0.1132   -0.1132   -0.1132    0.0520    0.0520    0.0520    0.0520    0.0520    0.0520    0.0520    0.0520    0.0520    0.0520 K>> max(d,[],1) ans =    -0.1132 K>>
 Subject: @\$%#^%*\$&#^\$&%!!!!! From: Petr Krysl Date: 22 Jun, 2012 01:21:07 Message: 2 of 3 ha ha, the complex numbers make it interesting "Petr Krysl" wrote in message ... > K>> d > > d = > > -0.0581 > -0.0031 > 0.0245 > 0.0245 > -0.0031 + 0.0000i > -0.0031 - 0.0000i > 0.0214 > 0.0214 > 0.0214 > -0.1132 > -0.1132 > -0.1132 > -0.1132 > -0.1132 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > 0.0520 > > K>> max(d,[],1) > > ans = > > -0.1132 > > K>>
 Subject: @\$%#^%*\$&#^\$&%!!!!! From: Steven_Lord Date: 22 Jun, 2012 13:22:29 Message: 3 of 3 "Petr Krysl" wrote in message news:js0ghn\$mfs\$1@newscl01ah.mathworks.com... > K>> d > > d = > > -0.0581 -0.0031 0.0245 0.0245 -0.0031 > + 0.0000i http://www.mathworks.com/help/techdoc/ref/max.html "For complex input A, max returns the complex number with the largest complex modulus (magnitude), computed with max(abs(A)). Then computes the largest phase angle with max(angle(x)), if necessary." Since at least one element of d is complex, d is a complex input and the magnitude of -0.1132 is greater than the magnitude of any of the other elements in the array. If you want to ignore the imaginary part when computing the maximum, use: maxValue = max(real(d), [], 1) *snip the remainder of d* -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com