I got a vector of type double let's say vec. When I perform for instance
test=vec.^ 1.4623;
I end up with test as complex double type, and I am wondering if there is a way to convert test to double since I'd like to get decimal values. ps: It's worth highligthing that I am not interested in real numbers retrieved from:
real(test)
As an illustration:
vec(2)^1.4623 = -1.8293^1.4623 = -2.4185
but instead i got:
test(2)=vec(2)^1.4623= -0.285678007027767 - 2.40147255196906i
In a nutshell, a way of converting:
test(2) = -2.4185
Thanks
You can temporarily "remove" the minus sign, which causes the complex numbers:
This results in:
A generic way of your conversion involves the
abs
function: