When I calculate exp(3.8566e5*1i) and exp(data*1i) answers are different why? Here, data=3.8566e5
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Prajan Pradhan
il 10 Nov 2014
Commentato: Prajan Pradhan
il 10 Nov 2014
>> Data
Data =
3.8566e+005
>> exp(1i*3.8566e5)
ans =
0.6076 + 0.7942i
>> exp(1i*Data)
ans =
1.0000 - 0.0000i
>>
0 Commenti
Risposta accettata
Roger Stafford
il 10 Nov 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 Commenti
Roger Stafford
il 10 Nov 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.
Più risposte (1)
Azzi Abdelmalek
il 10 Nov 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)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!