For anyone who want to solve a complex equation, which is hard to work out by hands (Like General Equlibrium in Economy) .

First method: Directly

  1. Define symbols (variables) of the equation:
syms k [more_varibles]
  1. Define the equation using the above symbols, for example:
eqn = (k^2+k)^2-0.98*(2-k^2)^2*(1+0.5/k) == 0
  1. Slove out the analytical solutions (解析解) if exits:
S = solve(eqn) % assign the result to S
  1. If you need a numerical solutions (数值解), draw a picture of the equation first to find out the range of solutions:
% draw in the vicinity of solutions 
% range from -4 to 2 (you could try another)
fplot([lhs(eqn) rhs(eqn)], [-4 2])

fig1.png

  1. Find out the numerical solutions in the certain range we have observered (we assume that k>0):
V = vpasolve(eqn,k,[0,1])

output:

>> V = vpasolve(eqn,k,[0,1])

V =

0.85411502864076704504148852270389

Second method: Multiple equations

TO-DO

Reference

MATLAB help documents

MATLAB online