| 
				 回复: 新手请教Matlab线代问题 
 
			
			第四题>> sym x1 x2 x3;
 >> [x1,x2,x3]=solve('4*x1+2*x2-x3=2','3*x1-x2+2*x3=10','12*x1+3*x2=8')
 
 x1 =
 
 -6
 
 
 x2 =
 
 80/3
 
 
 x3 =
 
 82/3
 
 第六题
 >> [V,D]=eig(A)
 
 V =
 
 0.7212    0.4443    0.5315
 -0.6863    0.5621    0.4615
 -0.0937   -0.6976    0.7103
 
 
 D =
 
 -0.0166         0         0
 0    1.4801         0
 0         0    2.5365
 V的列为特征向量,D为特征值
 
 实验三
 function t=chengjidengji(x)
 if(x>=90 & x<=100)
 t='A';
 elseif(x>=80 & x<=89)
 t='B';
 elseif(x>=70 & x<=79)
 t='C';
 elseif(x>=60 & x<=69)
 t='D';
 elseif(x>=0 & x<60)
 t='E';
 else
 t='error';
 end
 end
 注释:在Command Window中输入x=89;
 t=chengjidengji(x)即可得到结果,switch的自己试试看啦。
 
 实验六
 >> x=0:(pi/100):(pi);
 >> y1=x.^2;
 >> y2=cos(2*x);
 >> y3=y1.*y2;
 >> plot(x,y1,'*r',x,y2,'>g',x,y3,'db')
 子图可以通过subplot( , , )来画在同一个图形中,比如2行3列的话,就是subplot(2,3,x),x为第几副图
 条形图函数bar(),阶梯图stairs(),杆图stem(),填充图fill()
 
				 此帖于 2009-10-31 17:57 被 cxfchinacxf 编辑。
 |