フィルターのクリア

Numerical solution of a trigonometric equation

6 ビュー (過去 30 日間)
AtoZ
AtoZ 2018 年 11 月 5 日
編集済み: Torsten 2018 年 11 月 8 日

I want to solve the trigonometric equation, so that for each $x$ and $k$ we will have either 0,1 or 2 solutions.

sin(k+a)=x*cos(k)

$x$ is a variable, $a$ is real, (a is argument of a complex number) so I take $0<=a<=pi$ and similarly for $k$ I have the condition $0<=k<=pi$. How to solve it numerically? I am unsure whether to use 'solve' or 'vpasolve' or another method. Secondly, I want to visualize the solutions by creating a table of solutions [x,k] and by plotting them. I would do the following in Mathematica

eq[a_, k_, x_] := Sin[k + a] == x*Cos[k];
sol[x_?NumericQ, k_ /; 0 <= k <= Pi] := a /. 
NSolve[{eq[a, k, x], 0 <= a <= Pi}, a, Reals]

and then e.g., sol[0.1,0.1](=2.94193) would give me solution at x=0.1, k=0.1, and so on. Meaning that e.g., for each 'x', we can plot 'a' vs 'k'. and for each 'x' and 'k', we have a number of solutions either 0,1 or 2 etc. How to do it in MATLAB?

  5 件のコメント
AtoZ
AtoZ 2018 年 11 月 5 日
it gives an answer
asin(x*cos(k)) - k
pi - k - asin(x*cos(k))
I wanted to see the numerical results, preferably as a table/and or plot. So where can I give the range of values to the parameters?
AtoZ
AtoZ 2018 年 11 月 5 日
e.g., for each x, we can plot a vs k. and for each x and k, we have solutions either 0,1 or 2.

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

採用された回答

Torsten
Torsten 2018 年 11 月 5 日
編集済み: Torsten 2018 年 11 月 5 日
function main
a = fun(0.1,0.1)
end
function a = fun(x,k)
t = x*cos(k);
if abs(t) <= 1
sol(1) = asin(t) - k;
sol(2) = pi - k - asin(t);
a = sol(sol >=0 & sol <= pi);
else
a = [];
end
end
  14 件のコメント
Torsten
Torsten 2018 年 11 月 7 日
Thanks, Bruno, but equation was here
sin(k+a) = x*cos(k)
I think the OP just wants to experiment a bit with MATLAB.
Bruno Luong
Bruno Luong 2018 年 11 月 7 日
Ah OK.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by