polyval polyvalm
来源:互联网 发布:java soa架构是什么 编辑:程序博客网 时间:2024/06/05 20:33
polyval 只是计算一个多项式,这个你应该明白吧,help里的例子很清楚:
就是把x值带进去。
polyvalm比较特别的。但是明白这个之前,你需要明白什么是 characteristic polynomial:
In linear algebra, one associates a polynomial to every square matrix, its characteristic polynomial. This polynomial encodes several important properties of the matrix, most notably its eigenvalues, its determinant and its trace.
Suppose we want to compute the characteristic polynomial of the matrix
We have to compute the determinant of
and this determinant is
The latter is the characteristic polynomial of A.
现在回到我们自己的问题, 对于Y = polyvalm(p,X), 他的计算方法是:
Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)*I
如果写出for循环是:
for i = 1:np %多项式长度,m是X的维数
Y = X * Y + diag(p(i) * ones(m,1));
end
这个循环比较简单,不要我解释吧?
举个例子给你看,我把循环拆开:你再运行:
p=[1 2 3]
X=[1 2; 3 4]
polyvalm(p,X)
就是把x值带进去。
polyvalm比较特别的。但是明白这个之前,你需要明白什么是 characteristic polynomial:
In linear algebra, one associates a polynomial to every square matrix, its characteristic polynomial. This polynomial encodes several important properties of the matrix, most notably its eigenvalues, its determinant and its trace.
Suppose we want to compute the characteristic polynomial of the matrix
We have to compute the determinant of
and this determinant is
The latter is the characteristic polynomial of A.
现在回到我们自己的问题, 对于Y = polyvalm(p,X), 他的计算方法是:
Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)*I
如果写出for循环是:
for i = 1:np %多项式长度,m是X的维数
Y = X * Y + diag(p(i) * ones(m,1));
end
这个循环比较简单,不要我解释吧?
举个例子给你看,我把循环拆开:你再运行:
p=[1 2 3]
X=[1 2; 3 4]
polyvalm(p,X)
看看,结果是不是一样的。
总结一下:
polyval(p, t)是计算出来:
p(1)*t^n + p(2)*t^(n-1) + .... + p(n)
polyvalm(p, X)是计算出来:
p(1)*X^n + p(2)*X^(n-1) + .... + p(n)*I
这里要注意最后的I就是单位阵,不要忘了,否则会出错,比如:
>> p=[1 2 3];
>> X=[1 2; 3 4];
>> polyvalm(p, X)
ans =
12 14
21 33
>> p(1)*X*X+p(2)*X+p(3)
ans =
12 17
24 33
>> p(1)*X*X+p(2)*X+p(3)*eye(2, 2)
ans =
12 14
21 33
多谢各位,认真研究了下帖子,终于明白了,就是将矩阵X整体带入多项式中,求矩阵的多项式值:lol
0 0
- polyval polyvalm
- matlab2c使用c++实现matlab函数系列教程- polyval函数
- MySQL中涉及的几个字符集
- 黑马程序员- NSString和点圆的设计作业
- Struts2异常处理
- jsonObject for IOS
- Ubuntu字符界面输入密码始终提示错误 login incorrect 解决办法
- polyval polyvalm
- hadoop 集群安装
- 哈夫曼树以及哈夫曼编码的实现
- 21天学通Java学习笔记-Day10(网路编程)
- MVC,MVP,MVVM
- mysql增删改查语句
- 21天学通Java学习笔记-Day11(常用类)
- 漫谈linux文件IO--io流程讲的很清楚
- java nio 简介