When I calculate exp(3.8566e5*1i) and exp(data*1i) answers are different why? Here, data=3.8566e5

6 visualizaciones (últimos 30 días)
>> Data
Data =
3.8566e+005
>> exp(1i*3.8566e5)
ans =
0.6076 + 0.7942i
>> exp(1i*Data)
ans =
1.0000 - 0.0000i
>>

Respuesta aceptada

Roger Stafford
Roger Stafford el 10 de Nov. de 2014
When you display 'Data' with
Data =
3.8566e+005
the difference between the actual value of 'Data' and the displayed value due to rounding off in "format short" could be as large as .00005e+005 = 5 radians = 286 degrees, and that would completely alter the value of exp(Data*i) = cos(Data)+i*sin(Data). This is in addition to the discrepancy noted by Azzi.
  3 comentarios
Roger Stafford
Roger Stafford el 10 de Nov. de 2014
Here is what I say, Prajan. Very likely you are using "format short" by default and you probably set 'Data' to:
Data = 61380*2*pi;
Then you displayed Data and got
Data =
3.8566e+05
Then you displayed both exp(Data*i) and exp(3.8566e+05*i) and got:
ans =
1.0000 - 0.0000i
exp(3.8566e+05*i) =
-0.3367 - 0.9416i
However, if you had displayed Data more accurately, say using "format long", you would have got:
format long
Data =
3.856619141546830e+05
Then if you display exp(Data*i) and exp(3.856619141546830e+05*i), you will get:
ans =
1.00000000000000 - 0.00000000001103i
ans =
1.00000000000000 - 0.00000000001103i
Your problem was in evaluating exp for two different quantities. You thought they were the same because you were depending on the default and not very accurate "format short" for displaying them, but they were actually significantly different.

Iniciar sesión para comentar.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 10 de Nov. de 2014
Why are yoy surprised? you are using two different numbers (3.8566 and 3.856). try this
Data =3.8566e+005
exp(1i*3.8566e5)
exp(1i*Data)
  1 comentario
Prajan Pradhan
Prajan Pradhan el 10 de Nov. de 2014
Data
Data =
3.8566e+005
>> exp(Data*1i)
ans =
1.0000 - 0.0000i
>> exp(3.8566e+005*1i)
ans =
-0.3367 - 0.9416i
Now what do you say? I mistakenly left one digit after decimal.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by