MATLAB Answers

How do i find x in an equation using the solve command?

1 view (last 30 days)
Shimon Katzman
Shimon Katzman on 22 Nov 2019
Answered: Darshan Sen on 22 Nov 2019
Hi everyone,
I use MATLAB R2015a.
Can't solve a x in the matlab even for the simpliest equation like x-2=0. tryed everything.
thank you for your help.

  1 Comment

Darshan Sen
Darshan Sen on 22 Nov 2019
Hello Shimon. What error are you getting? Do you have the Symbolic Math Toolbox add-on?
Here's a thread you might find useful. :)

Sign in to comment.

Accepted Answer

Darshan Sen
Darshan Sen on 22 Nov 2019
Once you have the Symbolic Math Toolbox add-on, you may solve the equation like this
syms x
eqn = x - 2 == 0;
solx = solve(eqn, x)
You'll find this link useful too.
Hope this helps. :)

  0 Comments

Sign in to comment.

More Answers (1)

Erivelton Gualter
Erivelton Gualter on 22 Nov 2019
Do you have Symbolic Math Toolbox?
Try the following:
syms x
fcn = x-2;
solve(fcn == 0)

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags