Solving conditional nonlinear equations

2 vues (au cours des 30 derniers jours)
byungkeuk cho
byungkeuk cho le 20 Mai 2020
Commenté : Ameer Hamza le 20 Mai 2020
I have two equations as below.
equation 1 : a + b = 1;
equation 2 : b = a ( -0.3 < a < 0.3) or a + 0. 2 ( a >= 0.3 or a <= -0.3)
how can i get the answer?
The example is just for the question.
The real problem that I am facing is similar to it.
What I want to know is how to solve a conditional equation with matlab.
Thank you.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 20 Mai 2020
See this example
syms a b
eq1 = a + b == 1;
eq2 = b == piecewise(-0.3<a & a<0.3, a, a<=-0.3 | 0.3<=a, a+0.2);
sol = solve([eq1, eq2])
  2 commentaires
byungkeuk cho
byungkeuk cho le 20 Mai 2020
wow. Thank you very much.
piecewise is the one i should know.
Ameer Hamza
Ameer Hamza le 20 Mai 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by