function to increase the range of inverse sine

24 ビュー (過去 30 日間)
rick
rick 2011 年 9 月 14 日
編集済み: Walter Roberson 2018 年 10 月 26 日
The asin() function only returns values between (-pi/2, pi/2). How can I write a function to give me values between (0, 2pi)?

回答 (3 件)

Walter Roberson
Walter Roberson 2011 年 9 月 14 日
  1 件のコメント
Jan
Jan 2011 年 9 月 14 日
This will solve the problem by using the MATLAB 2013a or later. Not very efficient...

サインインしてコメントする。


the cyclist
the cyclist 2011 年 9 月 14 日
You can force the output to be within the range (0,2pi) by applying the mod() function:
>> mod(asin(x),2*pi)
Given only one input argument, you can't infer precisely which quadrant to return. Walter's answer points to a list of requested features (specifically, more two-argument versions of inverse trig functions).

theodore panagos
theodore panagos 2018 年 10 月 26 日
編集済み: Walter Roberson 2018 年 10 月 26 日
You can have the asin(x,y) from 0 to 2*pi by the formula:
asin(x,y)=pi-pi/2*(1+sgn(x))*(1-sgn(y^2))-pi/4*(2+sgn(x))*sgn(y) -sgn(x*y)*asin((abs(x)-abs(y))/sqrt(2*x^2+2*y^2))
there is x=x2-x1 and y=y2-y1

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by