Reputation: 21
I was wondering if someone would help me with this problem. I have complex 3x1 matrix that looks like,
matrix = np.matrix([[(0.0009118819655545739+0.0009118819655545738j)], [(0.0009118819655544588-0.0009118819655544589j)], [(-0.0009118819655545161-5.421010862427522e-20j)]])
As I am not interested in the last element I will delete as follows, so I get:
vector = np.delete(matrix, 2, 0)
This gives me,
vector = [[(0.0009118819655545739+0.0009118819655545738j)]]
[[(0.0009118819655544588-0.0009118819655544589j)]]
I am interested in finding the magnitude of the above vector (2X1). This is what I have done:
for element in vector:
mag = np.absolute(element)
return mag
What I get is the,
mag = 0.0012895958429705512
which is the magnitude of the first element.
How do I get the magnitude of the new 2x1 vector that incorporates the complex values of all elements in the vector?
Is the math correct: if I consider,
vector = [[(x1+x2j)]]
[[(y1-y2j)]]
As mag = sqrt((x1)**2 + (x2)**2 + (y1)**2 + (y2)**2)) which would instead give me a mag of 0.00182376392 rather than 0.0012895958429705512.
I would really appreciate the help with this problem.
Many thanks
Upvotes: 0
Views: 109