当前位置:网站首页>【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 逐位相减
边栏推荐
- 2022年3月11日记:王老师的春天,奇异的模板模式
- Xi'an Jiaotong 22nd autumn e-commerce technology online expansion resources (IV) [standard answer]
- Common message oriented middleware selection
- 支持Canvas的Leaflet.Path.DashFlow动态流向线
- CV—BaseLine总结(从AlexNet到SENet的发展历程)
- Test platform series (97) perfect the case part
- It is meaningful to define genus, and D can use it to explain semantics
- For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
- Heilongjiang Branch and Liaoning Branch of PostgreSQL Chinese community have been established!
- Lower interest rates lead to higher bond prices
猜你喜欢

So, what is the difference between e.target and e.currenttarget?

Comprehensive analysis of C array

CST learning: four element array design of circular patch antenna (II) array formation and combination results

leaflet如何优雅的展示重叠点位的气泡窗口

How to load 100000 pieces of data in leaflet

How leaflet gracefully displays the bubble window of overlapping points

Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma

array

VS2015 DLIB 1916 USER_ ERROR__ inconsistent_ build_ configuration__ see_ dlib_ faq_ 1 USER_ ERROR__ inconsiste

Model over fitting - solution (II): dropout
随机推荐
Design MySQL table structure for message queue to store information data
移动安全必备之CS呢【NETHUNTER】
M_8:设计消息队列存储消息数据的 MySQL 表格
Video tracker error troubleshooting
Record 5 - the serial port of stm32f411ceu6 realizes the sending and receiving of fixed length data and variable length data
实战 | UI 自动化测试框架设计与 PageObject 改造
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
Opencv source code compilation
2022年6月11日记:王老师的春天,混入
QT actual combat case (38) -- using qpprocess class to realize the function of starting process
2022 operation of simulated examination platform for hoisting machinery command certificate
The most complete preview! Huawei cloud wonderful agenda collection
Based on three JS offshore wind power digital twin 3D effect
2022年R2移动式压力容器充装考试题及在线模拟考试
How SAP ui5 uses manifest JSON file defines third-party library dependencies
Start blogging
How leaflet gracefully displays the bubble window of overlapping points
Leetcode1601: the maximum number of building change requests that can be reached (difficult)
[opencv learning] perspective transformation matrix
Novice must see! How rust beginners write gear smart contracts (1)