Solving an inequation of first degree issue

2 visualizaciones (últimos 30 días)
Rodrigo Toledo
Rodrigo Toledo el 1 de Abr. de 2021
Editada: John D'Errico el 1 de Abr. de 2021
Hello,
i am trying to solve this inequation:
a = 3*x + 21 <= 5*x + 13
the answer matlab is giving me when i use:
solve(a)
is 5. But the answer should be x>= 4. What i am doing wrong here?
Thanks

Respuesta aceptada

John D'Errico
John D'Errico el 1 de Abr. de 2021
Editada: John D'Errico el 1 de Abr. de 2021
syms x
a = 3*x + 21 <= 5*x + 13
a = 
asol = solve(a,'returnconditions',true)
asol = struct with fields:
x: [1×1 sym] parameters: [1×1 sym] conditions: [1×1 sym]
asol.x
ans = 
x
asol.conditions
ans = 
It looks like x >= 4 is the solution.
When you have a problem with multiple solutions, certainly an inequality like this, you need to tell MATLAB to describe the solution properly. When all I do is use solve on a, what does it do? It gives me AN answer, a valid solution to the problem.
solve(a)
ans = 
5
Read the help docs for solve, where it explains the use of this property.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by