write a program to determine the first and the second deriva

write a program to determine the first and the second derivatives of the following functions, using MATLAB symbolic functions:

f1(x) = x^3 - 4*x^2 + 3*x +8

f2(x) = (x^2 -2*x+1)(x_1)

f3(x) = cos(2*x)sin(x)

f4(x) = 3xe^(4*x^2)

Solution

Type the following code in matlab editor and press run button

clc
syms x
f1= x^3-4*x^2+3*x+8;
f2= (x^2-2*x+1)*(x-1);
f3= cos(2*x)*sin(x);
f4= 3*x*exp(4*x^2);
%symbolic function to find the first derivative is diff(f)
%Let first derivatives of f1 , f2 ,f3 and f4 are df1,df2,df3 and df4
%respectively
df1=diff(f1,x)
df2=diff(f2,x)
df3=diff(f3,x)
df4=diff(f4,x)
%similarly for second order is diff(f,x,2)
%Let second derivatives of f1 , f2 ,f3 and f4 are Df1,Df2,Df3 and Df4
%respectively
Df1=diff(f1,x,2)
Df2=diff(f2,x,2)
Df3=diff(f3,x,2)
Df4=diff(f4,x,2)

The result in command window is as follows

df1 =
3*x^2 - 8*x + 3


df2 =
(2*x - 2)*(x - 1) - 2*x + x^2 + 1


df3 =

cos(2*x)*cos(x) - 2*sin(2*x)*sin(x)


df4 =

3*exp(4*x^2) + 24*x^2*exp(4*x^2)


Df1 =

6*x - 8


Df2 =

6*x - 6


Df3 =

- 5*cos(2*x)*sin(x) - 4*sin(2*x)*cos(x)


Df4 =

72*x*exp(4*x^2) + 192*x^3*exp(4*x^2)

write a program to determine the first and the second derivatives of the following functions, using MATLAB symbolic functions: f1(x) = x^3 - 4*x^2 + 3*x +8 f2(x

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site