How this is possible? "atan(x) function problem"

5 ビュー (過去 30 日間)
Berat Can Karatas
Berat Can Karatas 2019 年 10 月 11 日
回答済み: Hemant Verma 2019 年 10 月 11 日
Hello Everyone!
I want to calculate the arctan function in MatLab.
But the result is a situation that I do not understand.
Normally, x = atan (1/0) is compleately NaN
Also, matlab says that x = arctan (1/0)
= 1.5708
How is that possible?
Sorry about this simple question but I could not find any information on the network.

採用された回答

Hemant Verma
Hemant Verma 2019 年 10 月 11 日
Just recall the basics of trigonometry, for a right-angled triangle
,
where P denotes perpendicular, B denotes base and θ denotes angle between hypotenuse and base of triangle.
In your case, where you want to compute arctan(1/0), the length of base B of triangle becomes 0. As B tends to 0, the hypotenuse and perpendicular of triangle start becoming colinear, and θ tends to 90 degrees or (i.e 1.5708) radians.
That's why you get

その他の回答 (1 件)

Stephan
Stephan 2019 年 10 月 11 日
編集済み: Stephan 2019 年 10 月 11 日
What is the problem?
a = 1/0
a =
Inf
atan(a)
ans =
1.5708
fplot(@(x)atan(x),[-100 100],'-b','LineWidth',2)
looks like the Wiki-Entry for me:

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by