how to solve inequality in matlab R2016a

2 ビュー (過去 30 日間)
Safdhan
Safdhan 2019 年 11 月 27 日
コメント済み: Safdhan 2019 年 11 月 29 日
I am trying to get the answer for the following inequality equation: (x-1)*(x-2)*(x-3)*(x-4)>0. Here is the code that I have used:
syms x
eqn = (x-1)*(x-2)*(x-3)*(x-4)> 0;
S = solve(eqn, x)
But I am getting the answer as:
S =
Empty sym: 0-by-1
Please somebody help me to get the answer in a proper manner.
I am using MATLAB R2016a

採用された回答

Stephan
Stephan 2019 年 11 月 27 日
In 2019b this works by using an assumption:
syms x real
eqn = (x-1)*(x-2)*(x-3)*(x-4)> 0;
S = solve(eqn, x)
% Test solutions
fun = @(x) (x-1).*(x-2).*(x-3).*(x-4);
res = fun(double(S))
I would expect this to work in 2016a also. Result is:
S =
5
0
exp(1)
res =
24.0000
24.0000
0.4457
  1 件のコメント
Safdhan
Safdhan 2019 年 11 月 29 日
Thank you very much. It helped me

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by