How do I get all solutions of the equation cos(x)==cos(3x) using solve() from Symbolic Math Toolbox ?
6 ビュー (過去 30 日間)
古いコメントを表示
I’ve tried the following code:
syms x
h(x)=cos(x)==cos(3*x);
[sol,par,cond]=solve(h,x,'returnconditions',true)
sol =
pi*k
par =
k
cond =
in(k, 'integer')
But I expected to obtain: k*pi/2.
Where am I wrong ? Thanks in advance.
0 件のコメント
回答 (1 件)
David Goodmanson
2018 年 3 月 26 日
Hi Angelo,
You didn't go wrong, it's missing half of the roots. But this works
h(x)=sin(x+pi/2)==sin(3*x+pi/2);
go figure.
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!