Help me solve this non-linear equation.

1 回表示 (過去 30 日間)
David Perez Ramos
David Perez Ramos 2015 年 2 月 23 日
編集済み: Andrew Newell 2015 年 2 月 23 日
Hello, I am new to MATLAB and I am trying to solve this non-linear equation, but the command windows said there is no solution found. Is this the right answer? Please see the picture attached in this questions. this is my code:
function z=eqns(x)
z(1)=sin(x(1).*x(2))^2;
z(2)=cos(x(1).*x(2));
end
Command Window:
>> solution = fsolve(@eqns,[-pi pi])
No solution found.
fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the default value of the function tolerance.
<stopping criteria details>
solution =
-3.1953 3.1953
Thanks

採用された回答

Andrew Newell
Andrew Newell 2015 年 2 月 23 日
Before using MATLAB, you should think about the math. Suppose that y = x(1)*x(2). You are trying to solve
sin(y) = 0
cos(y) = 0
(if sin(y)^2=0 then sin(y)=0). Does this have any solutions?
  2 件のコメント
David Perez Ramos
David Perez Ramos 2015 年 2 月 23 日
Thanks for your fast respond I was able to solve it thank to your answer.
Andrew Newell
Andrew Newell 2015 年 2 月 23 日
編集済み: Andrew Newell 2015 年 2 月 23 日
I hope your answer was no solutions!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by