(5/(r^2*9))- ((2)/(9*(6-r)^2)) - r = 0
would like to solve the above polynomial in matlab:
fun= (5/(r^2*9))- ((2)/(9*(6-r)^2))-r;
x0 = 10; % some initial point
x = fsolve(fun,x0)
Not working! Error: Undefined operator '.^' for input arguments of type 'function_handle'.
Just create the function handle and properly vectorize the function and it should work:
fun= @(r) (5./(r.^2*9))- ((2)./(9*(6-r).^2))-r;
x0 = 1; % some initial point (10 is not a good initial estimate)
x = fsolve(fun,x0)