How do I isolate a letter in some equation?

1 view (last 30 days)
i.e. I have an equation: 2=2*x.^2; or 2=2*log(x).^2; How can I get the value of x in MatLab?

Accepted Answer

James Tursa
James Tursa on 30 Nov 2016
Edited: James Tursa on 30 Nov 2016
symvar is probably what you are looking for. E.g.,
>> eqn = '2=2*log(x).^2';
>> symvar(eqn)
ans =
'x'
EDIT:
To solve for x, make a symbolic expression that you want to equal 0, and pass that to the solve() function:
>> syms x
>> eqn = 2*log(x).^2-2;
>> solve(eqn)
ans =
exp(1)
1/exp(1)
  1 Comment
Felipe Miotto
Felipe Miotto on 30 Nov 2016
Actually I'm trying to get the result of x; For instance, if I had 10=x.^3 the result expected would be 2.15

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!