当前位置:网站首页>【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 逐位相减
边栏推荐
- 最全预告!华为云精彩议程火速收藏
- SAP QM qp03 displays an inspection plan with multiple specs inspection features
- So, what is the difference between e.target and e.currenttarget?
- Actual combat | UI automation test framework design and pageobject transformation
- How leaflet gracefully displays the bubble window of overlapping points
- 2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
- [leetcode] understanding and usage of map[key]+
- SAP Business Technology Platform (BTP) workflow function introduction
- Mgr and greatsql resource summary
- leaflet中如何优雅的解决百度、高德地图的偏移问题
猜你喜欢
![[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)](/img/6f/890bfa8c2928712fecc6560c72bad9.jpg)
[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)

Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)

leaflet如何加载10万条数据

2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試

Case sharing of online real queuing system reconfiguration -- practical part

2022年电工(初级)操作证考试题库及在线模拟考试

Divicon est toujours utilisé dans le leaflet de l'ère H5?

Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies

Common message oriented middleware selection

数组
随机推荐
2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
How SAP ui5 uses manifest JSON file defines third-party library dependencies
CV—BaseLine总结(从AlexNet到SENet的发展历程)
[SciPy optimization tutorial] v. quick solution of univariate function optimization
Summary of the lowest level error types in PHP
2022年R2移动式压力容器充装考试题及在线模拟考试
Accelerating with Dali modules
CV - baseline summary (development history from alexnet to senet)
Find out the data that can match the keyword key in field 1 or field 2 in the database table. If you want to display the matching data in field 1 first
M_ 8: Design a MySQL table for message queue to store message data
Divicon est toujours utilisé dans le leaflet de l'ère H5?
2202 - production de CV
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
Using baserecyclerviewadapterhelper to implement tree structure
Cherry Blossom powder Dudu
华为云弹性云服务器ECS使用【华为云至简致远】
Leetcode 2164. 对奇偶下标分别排序(可以,一次过)
Pytorch loading model error resolution
支持Canvas的Leaflet.Path.DashFlow动态流向线
SAP QM qp03 displays an inspection plan with multiple specs inspection features