given the function f(x)=X^3 - 6X^2+9X. Find the first derivative of the function of f(x)

2 views (last 30 days)
given the function f(x)=X^3 - 6X^2+9X. Find the first derivative of the function of f(x)

Answers (2)

Sam Chak
Sam Chak on 2 May 2025
You can use the first derivative formula from Larson/Edwards Calculus of a Single Variable textbook.
For more info, please look up for examples in this link:
%% declare symbolic variable
syms x
%% function
a = 3;
b = 2;
c = 1;
y = x^a + 6*x^b - 9*x^c
y = 
%% 1st derivative formula
dy = a*x^(a-1) + 6*b*x^(b-1) - 9*c*x^(c-1)
dy = 
fplot([y, dy], [-8, 4]), grid on, xlabel x, ylabel f(x)

Star Strider
Star Strider on 2 May 2025
Use the polyder function —
f = @(x) x.^3 - 6*x.^2 + 9*x; % Anonymouus Function
p = [1 6 3 0] % Coefficient Vector
p = 1×4
1 6 3 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
dfdxp = polyder(p) % Polynomial Derivative
dfdxp = 1×3
3 12 3
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
x = -10:0.1:10;
figure
plot(x, polyval(p,x), DisplayName='f(x)')
hold on
plot(x, polyval(dfdxp,x), DisplayName='f''(x)')
hold off
grid
legend(Location='best')
You can also use the gradient funciton or the Symbolic Math Toolbox diff function for the derivative.
.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!