当前位置:网站首页>【Matlab】多项式计算
【Matlab】多项式计算
2022-06-12 23:46:00 【不牌不改】
多项式计算
多项式的表示
Matlab中用一个长度为 n + 1 n+1 n+1的行向量表示一个 n n n次多项式,向量中第一项表示 n n n次项,第二项表示 n − 1 n-1 n−1次项,……,最后一项即 n + 1 n+1 n+1项表示 0 0 0次项。
注意,有的项没有则系数补0。
多项式的四则运算
多项式的加减运算,即向量的加减运算;注意进行多项式加减法时,要保证两个向量长度一致,而乘除则不用保证。
多项式的乘运算,P = conv(p1, p2):p1和p2为相乘多项式的系数向量,P为结果多项式的系数向量。
多项式的除运算,[Q r] = deconv(p1, p2):Q为p1除以p2的商式,r为余式,Q和r仍为系数向量;存在关系:p1 = conv(p2, Q) + r。
f=[3,-5,0,-7,5,6];g=[3,5,-3];g1=[0,0,0,g];
f+g1
f-g1
conv(f, g)
[Q r] = deconv(f, g)
conv(g, Q)+r
结果如下:
ans =
3 -5 0 -4 10 3
ans =
3 -5 0 -10 0 9
ans =
9 0 -34 -6 -20 64 15 -18
Q =
1.0000 -3.3333 6.5556 -16.5926
r =
0 0 0 0 107.6296 -43.7778
ans =
3.0000 -5.0000 0 -7.0000 5.0000 6.0000
多项式的求导
p=polyder§:求多项式P的导函数。
p=polyder(P, Q):求P·Q的导函数。
[p q]=polyder(P, Q):求P/Q的导函数,导函数的分子存入p,分母存入q。
a=[3 1 0 -6];
b=[1 2];
polyder(a)
c = polyder(a, b) % 等价于d = conv(a, b);polyder(d)
[p q] = polyder(a, b) % 除法不存在等价形式
结果如下:
ans =
9 2 0
c =
12 21 4 -6
p =
6 19 4 6
q =
1 4 4
多项式的求值
polyval(p, x):p为多项式系数向量,x为数值、向量或矩阵,进行的点运算,求出x对应点在多项式上对应的值。
polyvalm(p, x):p为多项式系数向量,x为方阵,进行矩阵运算,求出方阵x代入多项式后求出的方阵(m为matrix)。
a=[1,8,0,0,-10];
x=[-1,1.2;2,-1.8];
y1=polyval(a,x)
y2=polyvalm(a,x)
结果如下:
y1 =
-17.0000 5.8976
70.0000 -46.1584
y2 =
-60.5840 50.6496
84.4160 -94.3504
多项式求根
roots§:求多项式p的全部根,包括实根和虚根。相当于已知多项式求根。
poly(x):x为多项式全部的根,此函数返回根为x的多项式系数向量。相当于已知根求多项式。
多项式积分
polyint(p, k):其中p是多项式系数组成的行向量,k是一个标量。这个函数的作用是对多项式p进行积分,把k作为积分后的常数项(因为对多项式积分后常数项不确定)。k省略时默认为0。
p = [1 1]; % p=x+1
k1 = polyint(p)
k1 = 0.5 1 0 % 积分结果为 0.5x^2 + x,常数项默认为0
k = 1;
k2 = polyint(p,k)
k2 = 0.5 1 1 % 积分结果为 0.5x^2 + x + 1,常数项为k,即1
∫ − 1 3 x 2 + 4 x − 5 d x \int_{-1}^{3} x^2+4x-5\space dx ∫−13x2+4x−5 dx
p = [1, 4, -5];
p1 = polyint(p, 5); % 常数项为5
a = -1;
b = 3;
val = diff(polyval(p1, [a, b])) % diff 逐位相减
边栏推荐
- Leetcode 2164. Sort odd and even subscripts separately (yes, once)
- [issue 30] shopee golang development experience
- 如何利用华为云容灾解决方案替代灾备一体机
- Mgr and greatsql resource summary
- SAP QM qp03 displays an inspection plan with multiple specs inspection features
- 數組
- Lower interest rates lead to higher bond prices
- Teach you how to grab ZigBee packets through cc2531 and parse encrypted ZigBee packets
- H5时代leaflet中还在用DivIcon?
- 2022 questions d'examen pour le personnel de gestion de la sécurité de l'unit é de gestion des produits chimiques dangereux et examen de simulation en ligne
猜你喜欢

2022 R2 mobile pressure vessel filling test questions and online simulation test
![[opencv learning] small ticket recognition based on perspective transformation and OCR recognition](/img/47/08b9dd9dbea9e9cb6deda975f4d652.jpg)
[opencv learning] small ticket recognition based on perspective transformation and OCR recognition

VS2015 DLIB 1916 USER_ ERROR__ inconsistent_ build_ configuration__ see_ dlib_ faq_ 1 USER_ ERROR__ inconsiste
![[kubernetes guide ④] pod quick start](/img/ed/e016d2469ee29a387238dc3b5ebbd6.png)
[kubernetes guide ④] pod quick start

〖Kubernetes指南④〗Pod快速入门

Examination questions and online simulation examination for safety management personnel of hazardous chemical business units in 2022

M_ 8: Design a MySQL table for message queue to store message data

测试平台系列(97) 完善执行case部分

Redis realizes SMS verification code login

Test platform series (97) perfect the case part
随机推荐
[opencv learning] small ticket recognition based on perspective transformation and OCR recognition
Face detection: mtcnn
Pytorch loading model error resolution
Running of NCF dapr application instance
Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
Basic operations of dict and set
M_ 8: Design a MySQL table for message queue to store message data
Shardingsphere-proxy-5.0.0 deployment table implementation (I)
VS2015 DLIB 1916 USER_ ERROR__ inconsistent_ build_ configuration__ see_ dlib_ faq_ 1 USER_ ERROR__ inconsiste
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
CV - baseline summary (development history from alexnet to senet)
How to get Matplotlib figure size
Lower interest rates lead to higher bond prices
Ast, really fragrant
Case sharing of online real queuing system reconfiguration -- practical part
Day 3 of jsbom and DOM learning
Using baserecyclerviewadapterhelper to implement tree structure
Leetcode 2200. 找出数组中的所有 K 近邻下标(可以,一次过)
Online examination questions for September examination of financial management
[kubernetes guide ④] pod quick start