How to solve for x in an sin equation?

조회 수: 10 (최근 30일)
JoBrr
JoBrr 2020년 9월 19일
댓글: JoBrr 2020년 9월 19일
Hi MATLAB wizards
I am currently trying to solve the following equation; -7sin(x/7)=0 using symbolic algebra and the solve function in MATLAB.
The code that I used is as follows:
syms x
solve( (-7*sin(x/7)),x)
This code returns the value 0, which is one of the solutions, the other one is 7*pi.
So how can I produce both of these solutions?
Any form of help would be appreciated.

채택된 답변

John D'Errico
John D'Errico 2020년 9월 19일
편집: John D'Errico 2020년 9월 19일
No. There are INFINITELY many solutions. So you cannot say you want the OTHER solution. You can simply enough find a positive solution though.
syms x positive
solve( (-7*sin(x/7)),x)
ans =
7*pi
  댓글 수: 1
JoBrr
JoBrr 2020년 9월 19일
Yes you are right there are many solutions.
But this seems to do the trick.
Cheers for the help.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David Hill
David Hill 2020년 9월 19일
[solx,parameters,conditions] = solve(eqn,x,'ReturnConditions',true);
  댓글 수: 1
JoBrr
JoBrr 2020년 9월 19일
편집: JoBrr 2020년 9월 19일
yeah that seems to work @David Hill.
But the output is like this:
solx =
7*pi*k
parameters =
k
conditions =
in(k, 'integer')
Not sure if I understand the k and conditions bits.
Here's the code I used in conjunction with yours:
eqn=-7*sin(x/7);
[solx,parameters,conditions] = solve(eqn,x,'ReturnConditions',true)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by