Error solving system of inequalities
2 次查看(过去 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.
采纳的回答
Raunak Gupta
2020-4-28
编辑:Raunak Gupta
2020-4-30
Hi,
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
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.
更多回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stability Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!