1 Using Matlab find all real and complex roots of the follow
1) Using Matlab, find all real and complex roots of the following polynomial equation:
(x-1)(x-2)(x-3)(x-4)(x-5)(x-6)(x-7)=8
2) Using Matlab, find the root for the following system of equations. Both x and y are positive.
a: (x^2)cos(y)=1
b: e^(-4x)+1
Solution
1.
function y = f(x)
y = (x-1)(x-2)(x-3)(x-4)(x-5)(x-6)(x-7) - 8;
%Find the zero of f(x) near 0.
fun = @f; % function
x0 = 0; % initial point
z = fzero(fun,x0)
OR
roots(p)
where p is a vector containing value of coefficient of x7,x6......constant term.
2. a)
syms x y
eqn = (x^2)cos(y) == 1;
solx = solve(eqn,x)
soly = solve(eqn,y)
b) no root exists for this equation you can try it with fzero

