matlab eig sort
来源:互联网 发布:电脑无法连接网络叹号 编辑:程序博客网 时间:2024/05/01 07:35
MatLab排序函数
sort函数的调用格式:
sort(X) 功能:返回对向量X中的元素按列升序排列的新向量。
[Y, I] = sort(A, dim, mode) 功能:对矩阵A的各列或各行重新排序,I记录Y中的元素在排序前A中位置,其中dim指明读A的列还是行进行排序。若dim=1,则按列排序;若dim=2,则按行排序。mode为排序的方式,取值'ascend'为升序,'descend'为降序。
- >> a=[1 2 3;3 9 6;4 10 8 ; 4 0 7]
- a =
- 1 2 3
- 3 9 6
- 4 10 8
- 4 0 7
- >> sort(a)
- ans =
- 1 0 3
- 3 2 6
- 4 9 7
- 4 10 8
- >> sort(a,1)
- ans =
- 1 0 3
- 3 2 6
- 4 9 7
- 4 10 8
- >> sort(a,1,'descend')
- ans =
- 4 10 8
- 4 9 7
- 3 2 6
- 1 0 3
- >> sort(a,2)
- ans =
- 1 2 3
- 3 6 9
- 4 8 10
- 0 4 7
- >> sort(a,2,'descend')
- ans =
- 3 2 1
- 9 6 3
- 10 8 4
- 7 4 0
- >>
>> a=[1 2 3;3 9 6;4 10 8 ; 4 0 7]a = 1 2 3 3 9 6 4 10 8 4 0 7>> sort(a)ans = 1 0 3 3 2 6 4 9 7 4 10 8>> sort(a,1)ans = 1 0 3 3 2 6 4 9 7 4 10 8>> sort(a,1,'descend')ans = 4 10 8 4 9 7 3 2 6 1 0 3>> sort(a,2)ans = 1 2 3 3 6 9 4 8 10 0 4 7>> sort(a,2,'descend')ans = 3 2 1 9 6 3 10 8 4 7 4 0>>
- b =
- 2 5 7 3 9 1 6
- >> [Y,I] = sort(b)
- Y =
- 1 2 3 5 6 7 9
- I =
- 6 1 4 2 7 3 5
- >>
在MATLAB中,计算矩阵A的特征值和特征向量的函数是eig(A),常用的调用格式有
5种:
(1) E=eig(A):求矩阵A的全部特征值,构成向量E。
(2) [V,D]=eig(A):求矩阵A的全部特征值,构成对角阵D,并求A的特征向量构成
V的列向量。
(3) [V,D]=eig(A,'nobalance'):与第2种格式类似,但第2种格式中先对A作相似
变换后求矩阵A的特征值和特征向量,而格式3直接求矩阵A的特征值和特征向量。
(4) E=eig(A,B):由eig(A,B)返回N×N阶方阵A和B的N个广义特征值,构成向量E
。
(5) [V,D]=eig(A,B):由eig(A,B)返回方阵A和B的N个广义特征值,构成N×N阶对
角阵D,其对角线上的N个元素即为相应的广义特征值,同时将返回相应的特征向
量构成N×N阶满秩矩阵,且满足AV=BVD。
eig
Find eigenvalues and eigenvectors
Syntax
d = eig(A)
d = eig(A,B)
[V,D] = eig(A)
[V,D] = eig(A,'nobalance')
[V,D] = eig(A,B)
[V,D] = eig(A,B,flag)
d = eig(A)和 [V,D] = eig(A)最为常用 注意,第一列为对应第一个特征值的特征向量。
附录:
matlab中关于eig的说明:
EIG Eigenvalues and eigenvectors.
E = EIG(X) is a vector containing the eigenvalues of a square
matrix X.
[V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a
full matrix V whose columns are the corresponding eigenvectors so
that X*V = V*D.
[V,D] = EIG(X,'nobalance') performs the computation with balancing
disabled, which sometimes gives more accurate results for certain
problems with unusual scaling. If X is symmetric, EIG(X,'nobalance')
is ignored since X is already balanced.
E = EIG(A,B) is a vector containing the generalized eigenvalues
of square matrices A and B.
[V,D] = EIG(A,B) produces a diagonal matrix D of generalized
eigenvalues and a full matrix V whose columns are the
corresponding eigenvectors so that A*V = B*V*D.
EIG(A,B,'chol') is the same as EIG(A,B) for symmetric A and symmetric
positive definite B. It computes the generalized eigenvalues of A and B
using the Cholesky factorization of B.
EIG(A,B,'qz') ignores the symmetry of A and B and uses the QZ algorithm.
In general, the two algorithms return the same result, however using the
QZ algorithm may be more stable for certain problems.
The flag is ignored when A and B are not symmetric.
如果被分解的矩阵是对称矩阵,特征值就会从小到大排列,但是如果是一般矩阵就没有什么规律。尝试一下用eigs替换eig。
本文来自: 高校自动化网(Www.zdh1909.com) 详细出处参考(转载请保留本链接):http://www.zdh1909.com/html/matlab/17910.html
- matlab eig sort
- matlab eig函数
- matlab中的eig函数
- MATLAB中的eig函数
- MATLAB中的eig函数
- matlab中的eig函数
- MATLAB中eig的作用
- 【MATLAB】matlab eig 函数…
- matlab程序运行eig函数时问题
- matlab eig() 计算矩阵…
- matlab中的eig函数 ,isa函数
- Matlab中的eig函数和eigs函数的异同点
- matlab中eig和eigs函数的引用
- [matlab] eig函数求解矩阵特征值和特征向量
- Matlab与Python中find/where、reshape、eig的区别
- matlab中的sort函数
- MATLAB中的sort用法
- matlab中的sort函数 .
- WinCE内核裁减(中文字体)及字库和内核的分离
- javascript 设置input文本为选中状态
- 选择Windows CE wince嵌入式操作系统 的十大理由
- 北京买二手房记 (IS2120@BG57IV3)
- javascript 数组方法
- matlab eig sort
- WinCE流设备驱动简介及GPIO驱动的实现
- 知人知面又知心:领导者识人用人之道
- 从后知后觉到先知先觉
- javascript 动态创建、删除行以及取值
- android 权限说明
- 黑马程序员----------张孝祥交通灯管理系统
- WinCE中串口驱动及接口函数介绍
- 数据库总结--SQL语句执行顺序