MATLAB Answers

Why does matlab give me the wrong answer?

21 views (last 30 days)
Linus Heierhoff
Linus Heierhoff on 14 Sep 2019
Commented: Rik on 20 Sep 2019
why?
  2 Comments
Linus Heierhoff
Linus Heierhoff on 14 Sep 2019
I would think that i would get something like this as a answer.
ans > 2

Sign in to comment.

Answers (1)

Priyanshu Mishra
Priyanshu Mishra on 18 Sep 2019
Although this answer is not wrong, but for getting conditions on the solution, set ‘ReturnConditions’ to true. It will return any parameter in the solution and conditions on the solution. You can try following code:
clear all; close all; clc;
syms x;
eqn = x-2 >= 0;
assume (eqn)
S= solve (eqn,x,'ReturnConditions',true)
S.conditions
  5 Comments
Rik
Rik on 20 Sep 2019
My problem is that many inexperienced users always see those together and don't understand what they do, but assume they are all required to set up a working script. I have no problem with people using them (I use them myself regularly), but I do think we should be selective in what we put in our answers, because like it or not, we are teaching people best practices every time we post an answer.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by