Problem 7: Estimate the derivative of the function f(x)e) by performing the fol-
ID: 3595851 • Letter: P
Question
Problem 7: Estimate the derivative of the function f(x)e) by performing the fol- lowing tasks. (a) Create a vector x that has values from- to with a step of /100. Set p7a_x. (b) Compute f and set p7b-f. (c) Use function diff to estimate the derivative f. Put the answer in p7c (d) What is maximum value of f? Put the answer in p7d. Problem 8: Estinate the following integral: by performing the following exercises. 55g(z) dz where g(z) = tanh"c) + cos"(z) (a) Create a vector z that has values from-5 to 5 with a step of 0.01. Set p8a=z. (b) Compute g and set p8bzg. (c) Use function sum to approximate the integral. Put the answer in p8c.Explanation / Answer
Solution to Problem 7 :
x = -pi:pi/100:pi; % Generates vector from -pi to +pi with step of pi/100
p7a = x;
f = exp(cos(x));
p7b = f;
p7c = diff(p7b); % Calculates differentiation
p7d = max(p7c)
Solution to Problem 8:
z = -5:0.01:5; % Generates vector from -5 to +5 with step of 0.01
p8a = z;
g = tanh(p8a).^2 + cos(p8a).^3;
p8b = g;
p8c = sum(p8b) %Calculates approximate integration