x = fzero(inline(‘f’),x0)
Note that one or two guesses can be employed. If two guesses are employed, they are
assumed a bracket a root.
>> x0=1;
>> fzero(inline('0.9*x^2+1.7*x-5'),x0)
ans =
1.5948
>> x0 = [1 4];
>> fzero(inline('x^2-2*x-3'),x0)
ans =
3.0000
If S is a symbolic expression,
Solve(S)
attempts to find values of the symbolic variable in S for which S is zero. This function
is most useful for the solving polynomials since it provides expressions for all roots.
ans =
5/2
-3
Example:
Solve
3x1 – 0.1x2 – 0.2x3 = 7.85
0.1x1 + 7x2 – 0.3x3 = -19.3
0.3x1 – 0.2x2 + 10x3 = 71.4
Activity:
Solve
12x1 – 3x2 – x3 = 15
x1 + 8x2 + x3 = 20
2x1 – x2 + 10x3 = 30