1.多项式的加减法在Matlab中实现的性质是什么?
P0=[2,5,9,3,0,2,5]
P0 =
2 5 9 3 0 2 5
>> y=poly2sym(P0)
y =
2*x^6 + 5*x^5 + 9*x^4 + 3*x^3 + 2*x + 5
P2=[1,2,3,0,0,8,7]
P2 =
1 2 3 0 0 8 7
y=poly2sym(P0+P2)
y =
3*x^6 + 7*x^5 + 12*x^4 + 3*x^3 + 10*x + 12
>> y2=poly2sym(P0-P2)
y2 =
x^6 + 3*x^5 + 6*x^4 + 3*x^3 - 6*x - 2
2.能否对多项式一次性多点求导?请对本练习中出现的相关多项式进行多点求导
c=polyder(P0)
c =
12 25 36 9 0 2
>> d=[c]
d =
12 25 36 9 0 2
>> a=[0,1,2,3,4,5,6,7];pa=polyval(d,a)
pa =
1 至 7 列
2 84 1110 5996 21138 57852 133814
8 列
274500
3.请创建两个多项式,进行除法运算,然后交换位置,再进行除法运算。
P3=[1,0,5,4];y=poly2sym(P3)
y =
x^3 + 5*x + 4
P4=[5,1,2,0,4];y=poly2sym(P4)
y =
5*x^4 + x^3 + 2*x^2 + 4
>> [a,b]=deconv(P3,P4)
a =
0
b =
1 0 5 4
换位置
[a,b]=deconv(P4,P3)
a =
5 1
b =
0 0 -23 -25 0
4.建立一个5矩阵。分别用polyval函数和polyvalm函数将矩阵代入f(x)=1.35+0.668x+0.436x^2+0.69552x^3计算结果,进行比较。
P5=[1,1,1,1,1;5,5,5,5,5;6,6,6,6,6;8,8,8,8,8;0,0,0,0,0]
P5 =
1 1 1 1 1
5 5 5 5 5
6 6 6 6 6
8 8 8 8 8
0 0 0 0 0
p=[0.69552,0436,0668,1.35];Pe=polyvalm(p,P5)
Pe =
1.0e+04 *
0.9668 0.9666 0.9666 0.9666 0.9666
4.8331 4.8332 4.8331 4.8331 4.8331
5.7997 5.7997 5.7999 5.7997 5.7997
7.7330 7.7330 7.7330 7.7331 7.7330
0 0 0 0 0.0001
>> p=[0.69552,0436,0668,1.35];Pf=polyval(p,P5)
Pf =
1.0e+04 *
0.1106 0.1106 0.1106 0.1106 0.1106
1.4328 1.4328 1.4328 1.4328 1.4328
1.9856 1.9856 1.9856 1.9856 1.9856
3.3605 3.3605 3.3605 3.3605 3.3605
0.0001 0.0001 0.0001 0.0001 0.0001