-1

I have an equation like this:

(5+x)^2/15+(x-4)^2/10=100

Can MATLAB solve this equation directly, without having access to the symbolic toolbox? If it can not do this, how can I resolve this problem?

Adriaan
  • 17,741
  • 7
  • 42
  • 75
voo
  • 9
  • 6

2 Answers2

3

It's possible, but requires some hand work.

Your function is a polynomial:

x^2/6 - (2*x)/15 + 49/15 = 100

When pulling the 100 to the left hand side, we can find the roots:

roots([1/6 -2/15 -1451/15])
ans =
   24.4948
  -23.6948

where the argument is specified as the prefactors in decreasing order of power.

Code with which I found the polynomial (requires the Symbolic Math toolbox):

syms x
fun = (5+x)^2/15+(x-4)^2/10-100;
f = simplify(fun);
Adriaan
  • 17,741
  • 7
  • 42
  • 75
-2

How about using an anonymous function:

f=@(x)(5+x)^2/15+(x-4)^2/10-100;
X0=1; % initial guess
x_out=fzero(f,X0);
Adriaan
  • 17,741
  • 7
  • 42
  • 75
Abo Lregal
  • 75
  • 8