线性代数的好帮手--迷你版Matlab及教程
该版本的迷你Matlab精简到不可思议,仅4.5MB,网上广泛流传,但其功能也大部分删减,不过作为计算线性代数计算矩阵的小工具还是非常不错的,放在U盘里,有电脑就能用。
点此下载此软件,后面的教程都是我亲自测试过可以使用的常用命令,全部和矩阵有关,并附加简要例子。解压压缩包后,运行matlab.cmd,进入命令输入状态。
技巧:按键盘上下键可以自动输入之前输入过的命令。
例:定义n*m矩阵:用[ ]把矩阵数据包起来,一行一行输入,以分号;分隔两行。
?a=[1 2;3 4] a = 1 2 3 4
例:矩阵的加、减、乘、求逆。假设矩阵a、b,并满足参与这些运算的条件,计算结果存放在c,则加法c=a+b,减法c=a-b,乘法c=a*b,求逆c=a^-1,求幂c=a^5
?c=a+a
c =
2 4
6 8?c=a-a
c =
0 0
0 0?c=a*a
c =
7 10
15 22?c=a^-1
c =
-2.0000 1.0000
1.5000 -0.5000
例:矩阵转置:a的转置为a加上一个单引号。
?a'
ans =
1 3
2 4
例:矩阵绝对值:每个矩阵的元素都取绝对值。取a的绝对值为abs(a)。更普遍的,对于普通的对某个数值的函数,如cos、sin、acos等,对矩阵的作用都变成该函数对矩阵每个元素的作用。
例:矩阵的行列式Det:取a的行列式值为det(a)
?det(a)
ans =
-2
例:求矩阵特征值。求a的特征值为eig(a),结果都是特征值。
?eig(a)
ans =
-0.3723
5.3723
例:生成n*n单位矩阵,为eye(n)。
?eye(3)
ans =
1 0 0
0 1 0
0 0 1
例:LU分解:LU分解是把一个矩阵分解成一个下三角矩阵和上三角矩阵。这两个矩阵相乘为原矩阵。
?[x,y]=lu(a)
x =
0.3333 1.0000
1.0000 0
y =
3.0000 4.0000
0 0.6667
例:求反条件数。如a的反条件数为rcond(a)。由于cond用不了,rcond反而能用,rcond越小,cond越大,矩阵越病态。
?rcond(a)
ans =
0.0476
例:奇异值分解:即把矩阵a分解成SVD形式,其中V是对角阵,S、D是标准正交矩阵,即S、D满足S*S'=I,D*D'=I
?[s v d]=svd(a)
s =
-0.4046 -0.9145
-0.9145 0.4046
v =
5.4650 0
0 0.3660
d =
-0.5760 0.8174
-0.8174 -0.5760
还有好多的命令这个精简版的Matlab用不了,不过上面这些对初学者已经足够了。
转载请注明:来自pugWoo's Life
本文地址:http://www.pugwoo.com/2010/01/3/mini-matlab.html
4 条评论
我要留言mulberry outlet 发表于 2011-11-22 at 16:41 回复 引用
christian louboutin replica high heels in our online uk store. Your shoes sales prices will save. Christian Louboutin Knockoffs shoes sale now, newest styles of christian louboutin high heels in hot sale now. Welcome to purchase!
mulberry outlet 发表于 2011-11-22 at 16:43 回复 引用
christian louboutin replica high heels in our online uk store. Your shoes sales prices will save. Christian Louboutin Knockoffs shoes sale now, newest styles of christian louboutin high heels in hot sale now. Welcome to purchase!
discount bags 发表于 2012-01-16 at 15:31 回复 引用
Cheap designer sungl 发表于 2012-02-07 at 11:41 回复 引用