% Polynomial多项式: 9x^3 - 5x^2 + 3x + 7
% -2 <= x <= 5
p = [9, -5, 3, 7]; % 多项式: x从3次方到0次方的系数,没有的项系数为0
x = -2 : 0.01 : 5; % 定义域
f = polyval(p, x); % 多项式的值
plot(x, f, 'LineWidth', 2); % 画图
xlabel('x');
ylabel('f(x)');
set(gca, 'FontSize', 14);
% Polynomial Differentiation多项式微分: polyder()
% Given: f(x) = 5x^4 - 2x^2 + 1
% derivative function f'(x) ?
% derivative function value of f'(7) ?
p = [5, 0, 2, 0, 1]; % f(x)
p1 = polyder(p) % f'(x)
polyval(p1, 7) % f'(7)