필터 지우기
필터 지우기

Error solving system of inequalities

조회 수: 1 (최근 30일)
Edoardo Cioffi
Edoardo Cioffi 2020년 4월 23일
댓글: Edoardo Cioffi 2020년 4월 30일
kvalue = solve(C(:,1)>0,k,'ReturnConditions',true);
k = kvalue.conditions;
As title states , I'm trying to solve this system. I tried to create my own routh criterion function and ,in order to check the result of the criterion ,I need to verify that all the elements of the first column of the matrix C are greater than zero. Therefore I have a system of inequalities with respect to k ,as you can see in the code I've attached, but when I run the code I keep getting the following error :
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
In routh (line 32)
ans =
Empty sym: 0-by-1
What should I do? Thanks in advance.
  댓글 수: 1
darova
darova 2020년 4월 23일
Use linprog for solving inequalities

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

채택된 답변

Raunak Gupta
Raunak Gupta 2020년 4월 28일
편집: Raunak Gupta 2020년 4월 30일
Hi,
As mentioned, here by Star Strider you can include 'IgnoreAnalyticConstraints'
kvalue = solve(C(:,1)>0,k,'ReturnConditions',true,'IgnoreAnalyticConstraints',1);
to check if a solution exists or not. Even if there are multiple solutions for k, solve will give parameters and conditions according to that.
  댓글 수: 3
Raunak Gupta
Raunak Gupta 2020년 4월 30일
편집: Raunak Gupta 2020년 4월 30일
Hi,
As Walter mentioned in another answer to this question, the problem is coming with the last equation that contains a division factor which is true for any value of k except k=2. As the simpllfy function simplifies the equation further it no longer create a issue to solve. The below line of code is working and giving the expected result.
kvalue = solve(simplify(C(:,1))>0,k,'ReturnConditions',true, 'IgnoreAnalyticConstraints',1);
You can check if it resolves the issue or not.
Edoardo Cioffi
Edoardo Cioffi 2020년 4월 30일
Yes , now it works .Thank you very much

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 4월 30일
sol = solve(simplify(C(:,1))>0,k)
The answer will be 3. Which will likely not be what you want if you care about the value of k.
If you just care about the whether a solution exists then
all(isAlways(C(:,1)>0,'Unknown', 'true'))
This is not exactly correct: there are formulas that exist that isAlways cannot decide for even though the result might be provable. For example
syms k
isAlways(k^2>0)
is not something it can decide: in this case because k was not constrained to real values, so potentially k might be complex-valued and k^2 might be negative or complex-valued. In more general cases, you could imagine formula and complex sets of constraints on the values that might just be too messy for isAlways to understand. And isAlways certainly cannot prove the Riemann Hypothesis, so asking isAlways(Imag(NextZetaZero(x))==1/2) is not something it would be able to prove.
Now, if on the other hand, you want MATLAB to return a set of (reduced) inequalities that define the complete solutions, then solve() cannot do that for you, but you can get at the inequalities if you are willing to feval(symengine) and analyze the result.

카테고리

Help CenterFile Exchange에서 Stability Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by