MATLAB: I need to plot this function and determine the exact valuse of the derrivative at x=1

#introto cal coding

F(x)= 2x^3-3x+4 for the interval [-2,2]

Best Answer

  • Check help symbolic, if blue letter show it's oknd run:
    % help symbolic
    clear all; clc; close all;
    syms fx x % Declare syms functions f(x) and x
    fx = 2*(x^3) - 3*x + 4; % Funtion f(x)
    Dfx = diff(fx,x); % f'(x)
    xx=-2:.1:2;
    subv = subs(fx,x,1); % Evalue f(x), x=1;
    dfx1 = double(subv) % Back to double the answer
    ez1=ezplot(fx,xx);
    hold on
    ez2=plot(1,dfx1,'ro'); % Show the point