0

I am trying to solve this equation: $e^x=x^e+e$ in MATLAB, but I continually get an error. I do not know where to go from here. Any help is appreciated This is what I have:

a = x^exp(1) + exp(1) == exp(x);
syms x
b = solve(a,x);
disp(b);

Nate
  • 1

1 Answers1

2

You need to tell Matlab that $x$ is symbolic before you use it. Swap your first and second lines.

enter image description here

Mike Miller
  • 2,453
  • I did that and recieved this error: Error using sym/subsindex (line 737) Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and the body of the function is a SYM expression. When indexing, the input must be numeric, logical, or ':'. – Nate Apr 27 '16 at 22:58
  • @Nate included an image to demonstrate with an approximate check. – Mike Miller Apr 27 '16 at 23:01
  • 1
    @Nate Is it possible you've made a mistake elsewhere in your code? I can't see why you should have any problem. – Mike Miller Apr 27 '16 at 23:07
  • 2
    Have you defined a variable called exp? Clear the workspace and run your code again. – David Apr 28 '16 at 01:02