Professional Documents
Culture Documents
LAB4
LAB4
Matlab can be effectively used to discover or locate the absolute extrema that is
absolute maximum and minimum values of a function.
In Matlab we have a built-in function fminbnd for figuring out the absolute
maximum and minimum values of a function on a given interval. This function also
reveals or identifies the points in the domain of function, where a function has
absolute maximum and absolute minimum values. Let us demonstrate this by
writing a program in Matlab.
In this program the user is asked to input a function as inline function of which we
want to find the absolute maximum and minimum values. The user is also asked
to input the initial and final points of an interval.
clc;
clear all;
syms x
f = input('Enter the function of which we want to find max and min values as
inline function \n f = ');
% occurs.
Let us run the above program for finding the absolute maximum and minimum
values of function f(x) = x2 – 2*x -3 on the interval [-2 3]
Enter the function of which we want to find max and min values as inline function
xi = -2
xf = 3
PRACTICAL APPLICATIONS
3
There are many practical applications in which we need to find the maximum and
minimum values of a certain function.
Suppose a company manufactures laptops. The total profit (in dollars) from
manufacturing and selling x laptops is given by the following profit function.
Now the question is how many laptops company should produce to maximize its
profit?
This implies we have to find the absolute maximum of profit function on the
interval [0 20000] . And at what value of x the maximum profit occurs.
syms x
xi = 0
xf = 20000
Thus, by producing 7500 laptops, company will realize the maximum profit of
925000 dollars.