%%

%Polynomials
    %representing polynomial in matlab using the coefficients values
    %p(x) = a0*x^n + a1*x^(n-1) + ... + a_(n-1)*x^1 a_n
    %example: a0 = 4, a1 = -5, a2 = 1, a3 = -2
p = [4 -5 2 -1]
    %value of the polynomial at particular points
polyval(p,0)
polyval(p,1)
polyval(p,3)

    %solving equations with polynomials p(x) = 0
p1 = [2 3 -12 -6]
roots(p1)    %finds all solutions

polynom_func = @(x) 2*x^3 + 3*x^2 - 12*x - 6
fzero(polynom_func,0)       %finds one solution based on intial estimation (second argument of the function)

%Non-linear functions

    %exponential function
exp_func = @(x) exp(x)-2*x-2
fzero(exp_func,2)       %finds one solution based on intial estimation (second argument of the function)

