help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dlmread complex number - sign inverted


From: siko1056
Subject: Re: dlmread complex number - sign inverted
Date: Mon, 27 Nov 2017 04:49:42 -0700 (MST)

inor0627 wrote
> Hello,
> 
> I tried to read a text file (complex.txt) containing complex numbers:
> 0; 3+4i; 22
> 
> the commands:
> format free;
> dlmread('complex.txt',';')'
> result in:
> ans =
>  (0,-0)
>  (3,-4)
>  (22,-0)
> 
> All number are converted to complex numbers, that's okay for me. But why
> is
> the sign of the imaginary part of 3+4i inverted?[...]

Dear Ingo,

This behavior is very expected, but fools me (this time again) often as
well.  The '-Operator is the complex conjugate transposition [1].

Thus

dlmread('complex.txt',';')
ans =

 (0,0) (3,4) (22,0)

and then of course:

dlmread('complex.txt',';')'
ans =

 (0,-0)
 (3,-4)
 (22,-0)


I think you want this:

 dlmread('complex.txt',';').'
ans =

 (0,0)
 (3,4)
 (22,0)

HTH,
Kai


[1] https://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]