当前位置:网站首页>【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 逐位相减
边栏推荐
- How to get Matplotlib figure size
- 数组
- 实战 | UI 自动化测试框架设计与 PageObject 改造
- Pytorch loading model error resolution
- 2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
- Model over fitting - solution (II): dropout
- Day 3 of jsbom and DOM learning
- Unprecedented analysis of Milvus source code architecture
- Buuctf-[ciscn 2019 preliminary]love math
- Enterprise wechat H5_ Authentication, PC website, enterprise wechat scanning code, authorized login
猜你喜欢
![[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

Running of NCF dapr application instance

Leetcode1601: the maximum number of building change requests that can be reached (difficult)

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

2022年R2移动式压力容器充装考试题及在线模拟考试

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

Develop a web office suite from scratch (5): mouse hover over text
![CS for mobile security [nethunter]](/img/25/ad99256a1eebb09f639e95d00756a5.jpg)
CS for mobile security [nethunter]

2202 resume making

Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具
随机推荐
Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
1111111111111111111111111111111111111111111111111111111
Explanation and practice of implicit transformation and implicit parameters in Scala
CST learning: four element array design of circular patch antenna (II) array formation and combination results
Access static variables within class in swift
Xi'an Jiaotong 22nd autumn e-commerce technology online expansion resources (IV) [standard answer]
For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
Novice must see! How rust beginners write gear smart contracts (1)
妙才周刊 - 5
[opencv learning] use the Tesseract OCR movement to recognize numbers
Save state when viewpager is used with fragment fragmentpageradapter
RT thread quick start - experience RT thread
36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA
How about opening a securities account in flush? Is it safe or not
设计消息队列存储信息数据的MySQL表结构
Mgr and greatsql resource summary
How to get Matplotlib figure size
Talent Weekly - 5
如何利用华为云容灾解决方案替代灾备一体机
〖Kubernetes指南⑤〗Label快速入门