当前位置:网站首页>【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 逐位相减
边栏推荐
- So, what is the difference between e.target and e.currenttarget?
- Leetcode1601: the maximum number of building change requests that can be reached (difficult)
- Save state when viewpager is used with fragment fragmentpageradapter
- Theory + practice will help you master the dynamic programming method
- Restrictions on MySQL function creation
- It is meaningful to define genus, and D can use it to explain semantics
- Mgr and greatsql resource summary
- Tsinghua University image source will cause tensorflow GPU installation failure
- Test platform series (97) perfect the case part
- 2202 - production de CV
猜你喜欢
RT thread quick start - experience RT thread
Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
AWS lambda: how to store secrets to external APIs- AWS Lambda: How to store secret to external API?
Buuctf-[ciscn 2019 preliminary]love math
Leetcode 890 finding and replacing patterns [map] the leetcode path of heroding
Enterprise wechat H5_ Authentication, H5 application web page authorization login to obtain identity
Comprehensive analysis of C array
CST learning: four element array design of circular patch antenna (II) array formation and combination results
移动安全必备之CS呢【NETHUNTER】
随机推荐
2022年6月11日记:王老师的春天,混入
[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)
华为云会议初体验【华为云至简致远】
How to publish OSM maps locally and customize the mapping
Accelerating with Dali modules
Running of NCF dapr application instance
线上真实排队系统重构案例分享——实战篇
Online examination questions for September examination of financial management
Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma
CV - baseline summary (development history from alexnet to senet)
Case sharing of online real queuing system reconfiguration -- practical part
[SciPy optimization tutorial] v. quick solution of univariate function optimization
2022 operation of simulated examination platform for hoisting machinery command certificate
The programmer has worked for 7 years. At the age of 31, he has no choice but to deliver takeout. I really don't want you to go through his journey again
数组
Enterprise wechat H5_ Authentication, H5 application web page authorization login to obtain identity
2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
OSM地图本地发布-如何生成各省市矢量地图
Record 5 - the serial port of stm32f411ceu6 realizes the sending and receiving of fixed length data and variable length data
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