资源描述:
《matlab中关于矩阵初等变换实验报告.》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验一一、实验目的熟悉MATLAB中关于矩阵初等变换的方法及矩阵运算的各种命令二、实验内容1、启动与退出2、数、数组、矩阵的输入>>a=5a=5>>b=2-5ib=2.0000-5.0000i>>a=5,a=5>>b=[1,2,3,4]b=1234>>c=1:2:11c=1357911>>d=linspace(1,11,6)d=1357911>>A=[2,3,5;1,3,5;6,9,4]A=2351356943.矩阵大小和定位:>>A=[3,5,6;2,5,8;3,5,9;3,7,9];>>d=nume
2、l(A)d=12>>[n,m]=size(A)n=4m=3>>[i,j]=find(A>3)i=12341234j=222233334.矩阵的块操作>>A(2,:);>>A([1,3],:);>>A(2:3,1:2)ans=2535>>A=[3,5,6;2,5,8;3,5,9;3,7,9];>>A([1,3],:)=A([3,1],:)A=359258356379>>A(2,:)=4;>>A(find(A==3))=-3;>>A(2,:)=[]A=-356-359-379>>A=[3,5,6;2,5,8
3、;3,5,9;3,7,9]A=356258359379>>diag(A,1)ans=58>>tril(A,1)ans=350258359379>>triu(A,1)ans=0560080000005.矩阵的翻转操作>>A=[3,5,6;2,5,8;3,5,9;3,7,9];>>flipud(A)ans=379359258356>>fliplr(A)ans=653852953973>>rot90(A)ans=6899555732336.特殊矩阵的产生>>a=eye(3)a=100010001>>b=one
4、s(2,3)b=111111>>c=zeros(3,4)c=000000000000>>d=rand(2,3)d=0.95010.60680.89130.23110.48600.7621>>magic(4)ans=162313511108976124141517.数的运算>>4+2ans=6>>4*2ans=8>>4/2ans=2>>42ans=0.5000>>4^3ans=64>>sqrt(9)ans=3>>exp(3)ans=20.0855>>log(4)ans=1.3863>>log2(4)an
5、s=28.矩阵的运算>>a=[1,2,3;4,5,6;7,8,9]a=123456789>>a'ans=147258369>>det(a)ans=0>>rank(a)ans=2>>inv(a)Warning:Matrixisclosetosingularorbadlyscaled.Resultsmaybeinaccurate.RCOND=1.541976e-018.ans=1.0e+016*-0.45040.9007-0.45040.9007-1.80140.9007-0.45040.9007-0.45
6、04>>eig(a)ans=16.1168-1.1168-0.0000>>[X,D]=eig(a)X=-0.2320-0.78580.4082-0.5253-0.0868-0.8165-0.81870.61230.4082D=16.1168000-1.1168000-0.0000>>trace(a)ans=15>>3*aans=369121518212427>>b=[234;456;678]b=234456678>>a+bans=35781012131517>>a-bans=-1-1-1000111>>
7、a*bans=283440647994100124148>>a/bWarning:Matrixissingulartoworkingprecision.ans=NaNNaNNaNNaNNaNNaNNaNNaNNaN>>abWarning:Matrixisclosetosingularorbadlyscaled.Resultsmaybeinaccurate.RCOND=1.541976e-018.ans=-0.6667-5.6667-6.66671.333310.333311.33330-4.0000-
8、4.0000>>a^2ans=303642668196102126150>>a.*bans=26121625364256729.变量的存储和调用>>a=2,b=3,c=5;a=2b=3>>savedataabc>>loaddata10.列出工作空间所有变量>>whosNameSizeBytesClassa1x18doublearrayb1x18doublearrayc1x18doublearrayGrandtotalis3elementsu