Solving multivariable equation using Matlab

  • Context: MATLAB 
  • Thread starter Thread starter denisexx
  • Start date Start date
  • Tags Tags
    Matlab Multivariable
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 13K views
denisexx
Messages
1
Reaction score
0
Hi, I have a problem in solving a multivariable equation. This multivariable consists of several variable which is known and are insert as input intially. For example: f(x)= a*x+b*x^2+-c*x+d(x^4+e)^2, f(x)=0 and a,b,c,d,e are inputs. I wanted to get the answer x. I have tried to use fzero and fsovle, but Matlab seem to stop at the first equation when it cannot determine the value x. The error shows : X is undetermined variable or equation.

Ask: Am i right to use fzero/fsolve in this case to solve this equation?
 
Physics news on Phys.org
denisexx said:
Am i right to use fzero/fsolve in this case to solve this equation
No, use solve instead:
Code:
syms x;
eqn = a*x+b*x^2+-c*x+d*(x^4+e)^2;
s = solve(eqn,x);
s.x