max and min complex number
Mostrar comentarios más antiguos
i have set that contain complex number, then i get the greatest value using max function and get the smallest value using min function. For example the max value is -0.0115230+0.0474206i and the minimum value is 0.0026796 + 0.0006868i But if i give this command -0.0115230+0.0474206i > 0.0026796 + 0.0006868i it get the result ans=0. So, how did it happen ? should the result is ans=1 ?? please help. i am very confused
Respuesta aceptada
Más respuestas (2)
Azzi Abdelmalek
el 7 de Jun. de 2016
Editada: Azzi Abdelmalek
el 7 de Jun. de 2016
If x1=1.1+2*i and x2=1+2.1*i What is the smallest number ? You can't compare two complex numbers, you can compare their modulus
abs(x1)>abs(x2)
I think max and min function, in your case, are finding the max and min of abs(your_array)
9 comentarios
ElizabethR
el 7 de Jun. de 2016
Editada: ElizabethR
el 7 de Jun. de 2016
Azzi Abdelmalek
el 7 de Jun. de 2016
Obviously, It's abs(x1)>abs(x2). Now it's up to you to tell us how you want to compare x1 and x2, by their modulus, or give us another criterion!
ElizabethR
el 8 de Jun. de 2016
Editada: ElizabethR
el 8 de Jun. de 2016
Azzi Abdelmalek
el 8 de Jun. de 2016
Editada: Azzi Abdelmalek
el 8 de Jun. de 2016
Ok, to get an answer, you need to clarify one thing:
If x1=1.1+2*i and x2=1+2.1*i What is the smallest value x1 or x2?
ElizabethR
el 8 de Jun. de 2016
Editada: ElizabethR
el 9 de Jun. de 2016
Stephen23
el 8 de Jun. de 2016
@eliz: that is what everyone is telling you. If you wish to create an order then you can use the magnitude.
ElizabethR
el 9 de Jun. de 2016
Guillaume
el 9 de Jun. de 2016
"If you wish to create an order then you can use the magnitude."
You can, but that ordering is not compatible with addition and multiplication. So, with that ordering, if you have
z1 < z2
You cannot assume that
z1 + c < z2 + c %c a complex constant
z1 * c < z2 * c, with c > 0 a complex constant
ElizabethR
el 14 de Jun. de 2016
Iain
el 7 de Jun. de 2016
0 votos
Max is calculating the absolute value, and then taking the maximum value, despite being negative.
Greater than is taking the value farthest from negative infinity.
7 comentarios
ElizabethR
el 8 de Jun. de 2016
Torsten
el 8 de Jun. de 2016
Say you have
z1 = 7 + 3*I
z2 = 5 - 6*I
Which number is greater and which number is smaller ?
Best wishes
Torsten.
Guillaume
el 8 de Jun. de 2016
"Max is calculating the absolute value, and then taking the maximum value, despite being negative.Greater than is taking the value farthest from negative infinity."
Neither is true for complex numbers according to the documentation.
ElizabethR
el 8 de Jun. de 2016
Editada: ElizabethR
el 8 de Jun. de 2016
ElizabethR
el 8 de Jun. de 2016
@eliz, I asked because your question had already been answered several times and it seemed to me you were not satisfied with these responses. So my guess was that you tried to ask something different, something we did not yet understand.
Best wishes
Torsten.
ElizabethR
el 14 de Jun. de 2016
Editada: ElizabethR
el 14 de Jun. de 2016
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!