%% Integrate Quartic Polynomial
% Evaluate the definite integral
% I = \int_{-1}^{3} \left( 3x^4 - 4x^2 +10x -25 \right) dx .
% Create a vector to represent the polynomial integrand 3x^4 - 4x^2 +10x -25. The x^3 term is absent and thus has a coefficient of 0.

p = [3 0 -4 10 -25];

%
% Use polyint to integrate the polynomial using a constant of integration equal to 0.

q = polyint(p)

%
% Find the value of the integral by evaluating q at the limits of integration.

a = -1;
b = 3;
I = diff(polyval(q,[a b]))

% Copyright 2015 The MathWorks, Inc.