[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The i operator
From: |
Ben Abbott |
Subject: |
Re: The i operator |
Date: |
Mon, 26 Jan 2009 07:02:47 -0500 |
On Jan 25, 2009, at 10:39 PM, Steve wrote:
Hi,
I’d appreciate some advice with Octave and use of the i imaginary
operator.
I can get this to work:
octave-3.0.3.exe:27> (2 * (pi) * 10.7e6 * 1.62e-6i)
ans = 0.00000 + 108.91273i
And this works where I define the constant w as 2*pi*10.7e6:
octave-3.0.3.exe:28> w = 2 * (pi) * 10.7e6
w = 6.7230e+007
octave-3.0.3.exe:29> (w * 1.62e-6i)
ans = 0.00000 + 108.91273i
I’d like to also define the constant L and use it in the calculation,
but I get this error:
octave-3.0.3.exe:30> w = 2 * (pi) * 10.7e6
w = 6.7230e+007
octave-3.0.3.exe:31> L = 1.62e-6i
L = 0.0000e+000 + 1.6200e-006i
octave-3.0.3.exe:32> w * Li
error: `Li' undefined near line 32 column 5
error: evaluating binary operator `*' near line 32, column 3
How does one use the i operator with constants so that Octave
recognizes
the i as the imaginary operator?
Thanks.
Steve
I assume you are asking for help, and not reporting a bug?
For the first example, the following works
(2 * (pi) * 10.7e6 * 1.62*10^(-6i))
ans = 3.4432e+07 - 1.0333e+08i
For the last, it can be wise to use 1i in the event "i" has been used
as a variable.
w = 2 * (pi) * 10.7e6;
L = 1.62*10^(-6i);
w * L * 1i
ans = 1.0333e+08 + 3.4431e+07i
Notice the answers for each of the above. The "i" is not part of the
exponent.
Evaluate 1e1i in either Matlab or Octave gives the same result.
1e1i
ans = 0 + 10i
Thus, just like the answers above, 1e1i is interpreted as (1e1)*1i
Ben