SlideShare una empresa de Scribd logo
1 de 2
第 3章 用 MATLAB 求极值

灵活的运用 MATLAB 的计算功能,可以很容易地求得函数的极值。

              3x 2 + 4 x + 4
例 3.6.1 求 y =                的极值
               x2 + x + 1

解 首先建立函数关系:
 syms s ↙
 y=(3*x^2+4*x+4)/( x^2+x+1); ↙
然后求函数的驻点:
 dy=diff(y); ↙
 xz=solve(dy) ↙
 xz=
    [0] [-2]

知道函数有两个驻点 x 1 =0 和 x 2 =-2,考察函数在驻点处二阶导数的正负情况:

    d2y=diff(y,2); ↙
    z1=limit(d2y,x,0) ↙
    z1=
     -2
    z2=limit(d2y,x,-2) ↙
    z2=
    2/9

于是知在 x 1 =0 处二阶导数的值为 z 1 =-2,小于 0,函数有极大值;在 x 2 =-2 处二阶导数的值

为 z 2 =2/9,大于 0,函数有极小值。如果需要,可顺便求出极值点处的函数值:

    y 1 =limit(y,x,0) ↙

    y1 =

    4

    y 2 =limit(y,x,-2) ↙

    y2 =

    8/3
事实上,如果知道了一个函数的图形,则它的极值情况和许多其它特性是一目了然的。   而借
助 MATLAB 的作图功能,我们很容易做到这一点。
 例 3.6.2 画出上例中函数的图形
 解 syms x ↙
     y=(3*x^2+4*x+4)/( x^2+x+1); ↙得到如下图形
      ezplot(y) ↙
03.第三章用Matlab求极值

Más contenido relacionado

Más de Xin Zheng

Humidity and temperature
Humidity and temperatureHumidity and temperature
Humidity and temperature
Xin Zheng
 
Humidity and temperature
Humidity and temperatureHumidity and temperature
Humidity and temperature
Xin Zheng
 
Release coats presentation-pstc
Release coats presentation-pstcRelease coats presentation-pstc
Release coats presentation-pstc
Xin Zheng
 
Release coating special additive product selection guide
Release coating special additive product selection guideRelease coating special additive product selection guide
Release coating special additive product selection guide
Xin Zheng
 
12.第十二章用Matlab计算第二类积分
12.第十二章用Matlab计算第二类积分12.第十二章用Matlab计算第二类积分
12.第十二章用Matlab计算第二类积分
Xin Zheng
 
11.第十一章用Matlab计算多元函数的积分
11.第十一章用Matlab计算多元函数的积分11.第十一章用Matlab计算多元函数的积分
11.第十一章用Matlab计算多元函数的积分
Xin Zheng
 
10.第十章用Matlab画空间曲线
10.第十章用Matlab画空间曲线10.第十章用Matlab画空间曲线
10.第十章用Matlab画空间曲线
Xin Zheng
 
07.第七章用Matlab解常微分方程
07.第七章用Matlab解常微分方程07.第七章用Matlab解常微分方程
07.第七章用Matlab解常微分方程
Xin Zheng
 
06.第六章用Matlab计算二重积分
06.第六章用Matlab计算二重积分06.第六章用Matlab计算二重积分
06.第六章用Matlab计算二重积分
Xin Zheng
 
04.第四章用Matlab求偏导数
04.第四章用Matlab求偏导数04.第四章用Matlab求偏导数
04.第四章用Matlab求偏导数
Xin Zheng
 
02.第二章用Matlab求导
02.第二章用Matlab求导02.第二章用Matlab求导
02.第二章用Matlab求导
Xin Zheng
 
01.第一章用Matlab求极限
01.第一章用Matlab求极限01.第一章用Matlab求极限
01.第一章用Matlab求极限
Xin Zheng
 
实验十 用Mathematica计算重积分
实验十  用Mathematica计算重积分实验十  用Mathematica计算重积分
实验十 用Mathematica计算重积分
Xin Zheng
 
实验一 Mathematica软件简介
实验一   Mathematica软件简介实验一   Mathematica软件简介
实验一 Mathematica软件简介
Xin Zheng
 
实验五 用Mathematica软件计算一元函数的积分
实验五  用Mathematica软件计算一元函数的积分实验五  用Mathematica软件计算一元函数的积分
实验五 用Mathematica软件计算一元函数的积分
Xin Zheng
 
实验六 用Mathematica软件进行 级数运算
实验六  用Mathematica软件进行 级数运算实验六  用Mathematica软件进行 级数运算
实验六 用Mathematica软件进行 级数运算
Xin Zheng
 
实验三 用Mathematica软件计算导数与微分
实验三  用Mathematica软件计算导数与微分实验三  用Mathematica软件计算导数与微分
实验三 用Mathematica软件计算导数与微分
Xin Zheng
 
实验七 用Mathematica解常微分方程
实验七  用Mathematica解常微分方程实验七  用Mathematica解常微分方程
实验七 用Mathematica解常微分方程
Xin Zheng
 
实验二 用Mathmatica软件求极限
实验二  用Mathmatica软件求极限实验二  用Mathmatica软件求极限
实验二 用Mathmatica软件求极限
Xin Zheng
 
实验九 用Mathematica软件求函数偏导数与多元函数的极值
实验九  用Mathematica软件求函数偏导数与多元函数的极值实验九  用Mathematica软件求函数偏导数与多元函数的极值
实验九 用Mathematica软件求函数偏导数与多元函数的极值
Xin Zheng
 

Más de Xin Zheng (20)

Humidity and temperature
Humidity and temperatureHumidity and temperature
Humidity and temperature
 
Humidity and temperature
Humidity and temperatureHumidity and temperature
Humidity and temperature
 
Release coats presentation-pstc
Release coats presentation-pstcRelease coats presentation-pstc
Release coats presentation-pstc
 
Release coating special additive product selection guide
Release coating special additive product selection guideRelease coating special additive product selection guide
Release coating special additive product selection guide
 
12.第十二章用Matlab计算第二类积分
12.第十二章用Matlab计算第二类积分12.第十二章用Matlab计算第二类积分
12.第十二章用Matlab计算第二类积分
 
11.第十一章用Matlab计算多元函数的积分
11.第十一章用Matlab计算多元函数的积分11.第十一章用Matlab计算多元函数的积分
11.第十一章用Matlab计算多元函数的积分
 
10.第十章用Matlab画空间曲线
10.第十章用Matlab画空间曲线10.第十章用Matlab画空间曲线
10.第十章用Matlab画空间曲线
 
07.第七章用Matlab解常微分方程
07.第七章用Matlab解常微分方程07.第七章用Matlab解常微分方程
07.第七章用Matlab解常微分方程
 
06.第六章用Matlab计算二重积分
06.第六章用Matlab计算二重积分06.第六章用Matlab计算二重积分
06.第六章用Matlab计算二重积分
 
04.第四章用Matlab求偏导数
04.第四章用Matlab求偏导数04.第四章用Matlab求偏导数
04.第四章用Matlab求偏导数
 
02.第二章用Matlab求导
02.第二章用Matlab求导02.第二章用Matlab求导
02.第二章用Matlab求导
 
01.第一章用Matlab求极限
01.第一章用Matlab求极限01.第一章用Matlab求极限
01.第一章用Matlab求极限
 
实验十 用Mathematica计算重积分
实验十  用Mathematica计算重积分实验十  用Mathematica计算重积分
实验十 用Mathematica计算重积分
 
实验一 Mathematica软件简介
实验一   Mathematica软件简介实验一   Mathematica软件简介
实验一 Mathematica软件简介
 
实验五 用Mathematica软件计算一元函数的积分
实验五  用Mathematica软件计算一元函数的积分实验五  用Mathematica软件计算一元函数的积分
实验五 用Mathematica软件计算一元函数的积分
 
实验六 用Mathematica软件进行 级数运算
实验六  用Mathematica软件进行 级数运算实验六  用Mathematica软件进行 级数运算
实验六 用Mathematica软件进行 级数运算
 
实验三 用Mathematica软件计算导数与微分
实验三  用Mathematica软件计算导数与微分实验三  用Mathematica软件计算导数与微分
实验三 用Mathematica软件计算导数与微分
 
实验七 用Mathematica解常微分方程
实验七  用Mathematica解常微分方程实验七  用Mathematica解常微分方程
实验七 用Mathematica解常微分方程
 
实验二 用Mathmatica软件求极限
实验二  用Mathmatica软件求极限实验二  用Mathmatica软件求极限
实验二 用Mathmatica软件求极限
 
实验九 用Mathematica软件求函数偏导数与多元函数的极值
实验九  用Mathematica软件求函数偏导数与多元函数的极值实验九  用Mathematica软件求函数偏导数与多元函数的极值
实验九 用Mathematica软件求函数偏导数与多元函数的极值
 

03.第三章用Matlab求极值

  • 1. 第 3章 用 MATLAB 求极值 灵活的运用 MATLAB 的计算功能,可以很容易地求得函数的极值。 3x 2 + 4 x + 4 例 3.6.1 求 y = 的极值 x2 + x + 1 解 首先建立函数关系: syms s ↙ y=(3*x^2+4*x+4)/( x^2+x+1); ↙ 然后求函数的驻点: dy=diff(y); ↙ xz=solve(dy) ↙ xz= [0] [-2] 知道函数有两个驻点 x 1 =0 和 x 2 =-2,考察函数在驻点处二阶导数的正负情况: d2y=diff(y,2); ↙ z1=limit(d2y,x,0) ↙ z1= -2 z2=limit(d2y,x,-2) ↙ z2= 2/9 于是知在 x 1 =0 处二阶导数的值为 z 1 =-2,小于 0,函数有极大值;在 x 2 =-2 处二阶导数的值 为 z 2 =2/9,大于 0,函数有极小值。如果需要,可顺便求出极值点处的函数值: y 1 =limit(y,x,0) ↙ y1 = 4 y 2 =limit(y,x,-2) ↙ y2 = 8/3 事实上,如果知道了一个函数的图形,则它的极值情况和许多其它特性是一目了然的。 而借 助 MATLAB 的作图功能,我们很容易做到这一点。 例 3.6.2 画出上例中函数的图形 解 syms x ↙ y=(3*x^2+4*x+4)/( x^2+x+1); ↙得到如下图形 ezplot(y) ↙