07-26-2010 06:27 PM
I'm trying to take the log of a number, and I need the real component. For example: log(-5) = 0.698970004 + 1.36437635 i
I need to be able to take the 0.698970004 and use that, whereas Labview just says its NAN.
I just figured out I can cast the inputs as a CPD, but then I'm still not sure how to convert back to having just the real component.
Ideas?
Thank you
Solved! Go to Solution.
07-26-2010 06:44 PM
The trick is to set the datatype representation of the number going into the Logarithm primitive. After that, it's easy to divide the complex number into real and imaginary components:
07-26-2010 06:46 PM - edited 07-26-2010 06:46 PM
And if your original datatype is not a complex datatype, be sure you "Type Convert" the wire, not "Typecast" the wire. There's a difference in semantics and in function. Type Convert preserves the values, while Typecast preserves bits.
07-26-2010 06:53 PM
Thank you, exactly the answer I was looking for