Minimizing & Maximizing Functions
Minimizing & Maximizing Functions
Nonlinear functions may have zero to many minima and maxima.
Example: find the minimum
of y = 3x2 - 2x + 1
Monday, November 17, 2008
? Minima & maxima occur in functions where the slope changes sign (i.e. where the slope is zero).
? Local vs. Global min & max.
? Polynomials: we can find all min & max (global & local)
? General functions: iterative procedure; may only find local min/max...
80
60
40
x3+5*x2
20
0
!20
!40
!6
!4
!2
0
2
x
9
Min & Max of Functions - Excel
1. Define a cell containing the independent variable (x)
2. Define a cell containing the function value at x, f(x).
3. Choose ToolsSolver 4. Select the target cell to be f(x). 5. Set "By Changing Cells" to be x. 6. Choose either max or min 7. Click "solve"
NOTE:You can also use solver to solve a nonlinear equation (choose to set target cell to a value rather than min/max).
Monday, November 17, 2008
10
Min & Max of Functions - MATLAB
Minimization
1. Define a MATLAB function to evaluate f(x) given x. 2. Obtain the minimum using fmin=fminsearch(fun,x0)
Maximization
1. Define a MATLAB function to evaluate -f(x) given x. 2. Obtain the minimum using fmax=fminsearch(fun,x0)
Monday, November 17, 2008
11
Many Nonlinear Equations (uncoupled)
f (t) = 1 - exp(-at) Find when f(t)=0.82 for a=[0.1 0.2 1].
function f = myExpFun(a,x) f=1-exp(-a*x);
f(t)
1
0.8
a=1
0.6
0.4
0.2
0
0
5
a=0.2
10 t
Monday, November 17, 2008
a=0.1
15
20
clear; clc; close all;
a = [0.1 0.2 1]; f = 0.82; figure; hold on;
for i=1:length(a) res=@(t)( myExpFun(a(i),t) - f); tanswer = fzero(res,0.1); fanswer = myExpFun(a(i),tanswer); tt=linspace(0,20); plot(tt,myExpFun(a(i),tt),'b-',... tanswer,fanswer,'ro' ); text( tanswer+0.5,... fanswer,... strcat('a=',num2str(a(i))) );
end
hold off; xlabel('t'); ylabel('f(t)');
12
Nonlinear Systems of Equations
Example: find the solution of the equations:
x=
y-3 2
y = x3 + x2 - 6x + 3
40
? Solve analytically...
? What condition(s) are we looking for, and how do we express these mathematically?
? Solve this using Excel
? Solve this using MATLAB
r1 = x -
y-3 2
r2 = y - x3 - x2 + 6x - 3
f ,f
12
30
y = 2x2 + 3
y = x3 + x2 - 6x + 3
20
10
0
Are all of these roots representative
of the original system?
!10
!4
!2
0
2
4
x
Monday, November 17, 2008
13
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- x a f q x f x
- 6 jointly continuous random variables
- finding square roots using newton s method
- ap calculus ab 2013 scoring guidelines
- square roots via newton s method
- chapter 5 limit theorems sdsu library
- math 104 improper integrals with solutions
- ap calculus ab 2012 scoring guidelines
- real analysis math 125a fall 2012 final solutions 1 r
- rootfinding for nonlinear equations
Related searches
- find profit maximizing price
- how to find maximizing profit
- profit maximizing price formula
- deflecting and minimizing behavior
- maximizing profit calculus problems
- maximizing profit formula
- how to calculate profit maximizing output
- profit maximizing rule
- profit maximizing calculator
- maximizing revenue formula
- profit maximizing price equation
- profit maximizing output