0% found this document useful (0 votes)
8 views3 pages

Labsheet 6 (Mean Value Theorem, Maxima and Minima)

This lab sheet provides instructions for applying the Mean Value Theorem and finding critical points, maxima, and minima of functions using MATLAB. It includes essential MATLAB commands and examples for calculating average rates of change, derivatives, and analyzing critical points. Additionally, it contains exercises for further practice in identifying critical points and plotting functions.

Uploaded by

ADHI KESAVAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Labsheet 6 (Mean Value Theorem, Maxima and Minima)

This lab sheet provides instructions for applying the Mean Value Theorem and finding critical points, maxima, and minima of functions using MATLAB. It includes essential MATLAB commands and examples for calculating average rates of change, derivatives, and analyzing critical points. Additionally, it contains exercises for further practice in identifying critical points and plotting functions.

Uploaded by

ADHI KESAVAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab Sheet: Mean Value Theorem, Maxima, and Minima of Functions in

MATLAB
Objective
This lab will guide you through applying the Mean Value Theorem (MVT) and finding
critical points, maxima, and minima of functions using MATLAB. You’ll analyze
functions and use derivatives to identify intervals of increase and decrease, as well
as local maxima and minima.
MATLAB Commands to Know
 syms — Define symbolic variables.
 diff — Compute the derivative of a function.
 solve — Solve equations symbolically.
 subs — Substitute values into symbolic expressions.
 fplot — Plot functions.
 double — Convert symbolic expressions to numerical values.
1. Mean Value Theorem in MATLAB

syms x c
f = x^2 + 2*x;
a = 1;
b = 4;

% Calculate the average rate of change


avg_rate = (subs(f, x, b) - subs(f, x, a)) / (b - a);

% Find f'(x) and solve for f'(c) = avg_rate


df = diff(f, x);
c_value = solve(df == avg_rate, x);

disp('The value(s) of c that satisfy the MVT are:');


disp(c_value);
disp('f(c) value(s) at these points:');
disp(subs(f, x, c_value));
2. Finding Maxima and Minima

syms x
f = x^3 - 3*x^2 + 2;

% Find the first derivative and critical points


df = diff(f, x);
critical_points = solve(df == 0, x);

% Find the second derivative


d2f = diff(df, x);

% Determine whether each critical point is a max or min


for i = 1:length(critical_points)
point = critical_points(i);
second_deriv = subs(d2f, x, point);
if second_deriv > 0
fprintf('x = %.2f is a local minimum.\n', double(point));
elseif second_deriv < 0
fprintf('x = %.2f is a local maximum.\n', double(point));
else
fprintf('x = %.2f is a saddle point.\n', double(point));
end
end
3. Exercises
Complete the following exercises in MATLAB, plotting the function when
appropriate, and identifying all critical points, maxima, and minima.

You might also like