0

I am new to Matlab. I know that for simple equations, the solve() function in matlab can return all the real roots. however I want to find the roots, and especially, the smaller root of this equation:

1-(x/5) + (x/5)*log(x/5) = 0.4

when I use ezplot(1-(x/5) + (x/5)*log(x/5)), I can get this graph: enter image description here

We know that the value of the expression definitely goes to infinity as x -> inf. So 1-(x/5) + (x/5)*log(x/5)=0.4 would clearly have 2 different real roots.

However when I use solve(1-(x/5) + (x/5)*log(x/5) == 0.4), I can only get the expression of the greater root, which is evaluated to 10.0982. There should be another root at around x = 1.2 but I cannot find it from the ans.

Would anyone tell me why the function won't return anything about the smaller root? Is it because the exact expression of the root cannot be found? How can I get the numeric value of this root?

Thanks.

user1731839
  • 125
  • 2
  • 9
  • As @Daniel has mentioned in his comment (see his linked question) said, if you use `vpasolve` with an initial value, you do get 1.2 as the root. Marking this question as a duplicate. FYI, the command using `vpasolve` is `s=vpasolve(eq1,x,1);` – Autonomous Aug 26 '14 at 03:35
  • 1
    There are other options that you can try – see [my answer here](http://stackoverflow.com/a/23847079/2278029) and [here](http://stackoverflow.com/questions/21786082/am-i-using-a-wrong-numerical-method/21788199#21788199). – horchler Aug 26 '14 at 05:27
  • The problem seems not to be that it is not possible to find all analytic solutionns. If you try to solve the equation you will get a symbolic solution. Could it be so that the other solution is not a rational number? – patrik Aug 26 '14 at 08:59

0 Answers0