matlab-自控原理 taylor 泰勒展开 一、二元函数

慈心积善融学习,技术愿为有情学。善心速造多好事,前人栽树后乘凉。我今于此写经验,愿见文者得启发。


  •                     matlab : R2018a 64bit
  •                             os : win7
  •            type setting : markdown
  •                         blog : https://blog.csdn.net/yushaopu
  •                     github : https://github.com/GratefulHeartCoder

一元函数的泰勒展开

code

clear
clc

syms x;

f=exp(x);

zf1=taylor(f,x)   % 不说明的话,就是6阶的展开
zf2=taylor(f,x,'order',10)   % 要这样的话,就要10阶展开了,
                             % 这个东西自己看英文的说明,百度有没有?有,但是很难找到。

g=sin(x)
zf3=taylor(g,x,pi/4)   % 展开成x-pi/4
pretty(zf3)                             

result


zf1 =

x^5/120 + x^4/24 + x^3/6 + x^2/2 + x + 1


zf2 =

x^9/362880 + x^8/40320 + x^7/5040 + x^6/720 + x^5/120 + x^4/24 + x^3/6 + x^2/2 + x + 1


g =

sin(x)


zf3 =

(2^(1/2)*(x - pi/4))/2 + 2^(1/2)/2 - (2^(1/2)*(x - pi/4)^2)/4 - (2^(1/2)*(x - pi/4)^3)/12 + (2^(1/2)*(x - pi/4)^4)/48 + (2^(1/2)*(x - pi/4)^5)/240

        /     pi \                     /     pi \2           /     pi \3           /     pi \4           /     pi \5
sqrt(2) | x - -- |             sqrt(2) | x - -- |    sqrt(2) | x - -- |    sqrt(2) | x - -- |    sqrt(2) | x - -- |
        \      4 /   sqrt(2)           \      4 /            \      4 /            \      4 /            \      4 /
------------------ + ------- - ------------------- - ------------------- + ------------------- + -------------------
         2              2               4                     12                    48                   240

>> 

二元函数的泰勒展开

code

clear
clc

syms x y
f = log(x+y+1)
f1=taylor(f, [x y],'order',4)

result


f =

log(x + y + 1)


f1 =

x^3/3 + x^2*y - x^2/2 + x*y^2 - x*y + x + y^3/3 - y^2/2 + y

>> 

resource


感恩曾经帮助过 心少朴 的人。
matlab优秀,值得学习。基础知识 + 专业知识 + matlab = ?
注:此文是自学笔记所生,质量中下等,故要三思而后行。新手到此,不可照搬,应先研究其理象数,待能变通之时,自然跳出深坑。

猜你喜欢

转载自blog.csdn.net/yushaopu/article/details/81087752