Error solving system of inequalities
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Edoardo Cioffi
le 23 Avr 2020
Commenté : Edoardo Cioffi
le 30 Avr 2020
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 commentaire
Réponse acceptée
Raunak Gupta
le 28 Avr 2020
Modifié(e) : Raunak Gupta
le 30 Avr 2020
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 commentaires
Raunak Gupta
le 30 Avr 2020
Modifié(e) : Raunak Gupta
le 30 Avr 2020
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.
Plus de réponses (1)
Walter Roberson
le 30 Avr 2020
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 commentaires
Voir également
Catégories
En savoir plus sur Stability Analysis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!