When I calculate exp(3.8566e5*1i) and exp(data*1i) answers are different why? Here, data=3.8566e5
조회 수: 5 (최근 30일)
이전 댓글 표시
>> Data
Data =
3.8566e+005
>> exp(1i*3.8566e5)
ans =
0.6076 + 0.7942i
>> exp(1i*Data)
ans =
1.0000 - 0.0000i
>>
댓글 수: 0
채택된 답변
Roger Stafford
2014년 11월 10일
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
Roger Stafford
2014년 11월 10일
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.
추가 답변 (1개)
Azzi Abdelmalek
2014년 11월 10일
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)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!