1 / 15

§2.6 MATLAB 在导数中的应用

§2.6 MATLAB 在导数中的应用. 在 MATLAB 里由命令函数 diff() 来完成求导运算,其具体形式为: diff(function,’variable’,n) 参数 function 为需要进行求导运算的函数, variable 为求导运算的独立变量, n 为求导的阶次 . 命令函数 diff() 默认求导的阶次为1阶;如果表达式里有多个符号变量,并且没有在参数里说明,则按人们习惯的独立变量顺序确定进行求导的变量. 案例 2.22. 案例 2.23. 案例 2.24. 案例 2.25.

renee-frye
Download Presentation

§2.6 MATLAB 在导数中的应用

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. §2.6 MATLAB在导数中的应用 在MATLAB里由命令函数diff()来完成求导运算,其具体形式为: diff(function,’variable’,n) 参数function为需要进行求导运算的函数,variable为求导运算的独立变量,n为求导的阶次.命令函数diff()默认求导的阶次为1阶;如果表达式里有多个符号变量,并且没有在参数里说明,则按人们习惯的独立变量顺序确定进行求导的变量. 案例2.22 案例2.23 案例2.24 案例2.25

  2. 用Matlab的求解过程: >> clear %清除内存内保存的变量 >> syms x %定义变量 >> y=10*x*exp(-x/2); %收益函数 >> dy1=diff(y) %对收益函数y求一阶导 数得边际收益函数 dy1 =10*exp(-1/2*x)-5*x*exp(-1/2*x) >> Px=solve(dy1) %求边际收益函数 dy1的驻点 Px =2

  3. >> dy2= diff(dy1) %求dy1的一阶导数即y的二阶导数, %此时也可用命令diff(y,2)来求 dy2 =-10*exp(-1/2*x)+5/2*x*exp(-1/2*x) >> x=Px; >> dy2 dy2= -1.8394 >>y y = 7.3576 返回

  4. 用Matlab的求解过程: >> syms x r p %定义变量 >> r=x*(3-(x/40))^2; %总收入 >> dr1=diff(r) dr 1= (3-1/40*x)^2-1/20*x*(3-1/40*x) >> Pr=solve(dr1) Pr = [ 40] [ 120]

  5. >> dr2=diff(dr1) dr2 = -3/10+3/800*x >> x=40; >> dr2 dr2 = -0.1500 >> p=(3-(x/40))^2 p = 4 返回

  6. 返回

  7. 用Matlab的求解过程: >> syms p q >> L=((12000-q)/80)*q-(25000+50*q)-2*q; >> dL=diff(L) dL = -1/40*q+98 >> Pq=solve(dL) Pq = 3920

  8. >> dL2=diff(dL) dL2 = -1/40 >> P1=solve(12000-80*p-3920) P1 = 101 >> L0=((12000-Pq)/80)*Pq-(25000+50*Pq)-2*Pq L0 = 167080 返回

More Related