1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 >> D=tril(a,-1) D =
Columns 1 through 7
0 0 0
1 0 0
1 0 0
1 0 0
1 0 0
1 0 0
1 1 0
1 1 1
1 1 1
1 1 1
Columns 8 through 10
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 - 16 -
0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1
1 0 0 1 1 0
>> W=A+D W =
Columns 1 through 7
10 0 0 0
1 20 0 0
1 1 0 0
1 1 0 0
1 1 0 0
1 1 60 0
1 1 1 70
1 1 1 1
1 1 1 1
1 1 1 1
Columns 8 through 10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 80 0 1 90 1 1 - 17 -
0 0 30 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0
100 0 0 0 0 0 0 40 0 1 50 1 1 1 1 1 1 1 1 1 1 (6)
?11?23??11?34?????11??11121?11??1??12? ????1???20??000??200420??020043000??02004400? (7)?0??000200450???00002004???6.绘制下列曲线的图形(散点图与折线图):y?3x3?x2?x?1,x?[?1,2]
7.绘制下列曲面的图形:z2?x2?2y2(提示:曲面由两部分构成) 8.在同一个图形上作下列两个函数的图象:
(1)y?sin2(x),x?[0,2?]; (2)y?cos2(x),x?[0,2?]
9.假如你有一组实测数据,例如:
x=[53 56 60 67.5 75 90 110]; y=[109 120.5 130 141.1 157.5 180 185]; 求其回归直线,画回归直线图形并计算最小误差平方和. 10.假如你有一组实测数据,例如:
x=[75 86 95 108 112 116 135 151 155 160 163 167 171 178 185]; y=[10 12 15 17 20 22 35 41 48 50 51 54 59 66 75]; 求其回归直线,画回归直线图形并计算最小误差平方和.
11.随机产生500个0到100的整数FS作为学生的考试分数.
(1) 画出FS的简单直方图;
(2) 画出每个分数段(0~10、10~20、…,90~100)的统计频数直方图; 12.求下列各结果:
(1)用Matlab因式分解:x100?1.
(2)用Matlab求极限:L?limx?0(1?x)?e.
x1x(3)用Matlab求积分:
?0??sinx2dx.
(4)用Matlab求幂级数:
?(?1)n?1?n?1x2n?14n?12的和函数(化简结果).
- 18 -
13.非线性回归尝试
下表是到1994年的游泳世界纪录,试估计时间y与距离x的关系. 距离x(米) 时间y(秒) 50 21.81 100 48.42 200 106.69 400 225 800 466.60 1500 863.48 x,但当x?18时,y??0.2794,说明:用线性回归方法将得到:y??11.0089?0.5961这是非常荒唐的结果!显然,一个基本要求是当x?0时y?0.试尝试使用非线性回归模型: y?axb.
14. (三维)符号作图尝试 命令 ezplot3 ezcontour ezcontourf ezmesh ezmeshc ezsurf ezsurfc 作用 3-D parametric curve plotter use contour plotter filled contour plotter 3-D mesh plotter combination mesh/contour plotter 3-D colored surface plotter combination surf/contour plotter 解释 3D参数曲线图形 等高线图 填充等高线图 3D mesh曲面图形 mesh曲面/等高线图 3D surf曲面图形 surf曲面/等高线图
请尝试以下的命令:
ezplot3('sin(t)', ' cos(t)', 't', [0,6*pi]) ezcontour('x*exp(-x^2 - y^2)') ezcontourf('x*exp(-x^2 - y^2)')
ezmesh('(s-sin(s))*cos(t)','(1-cos(s))*sin(t)','s',[-2*pi,2*pi]) ezmeshc('(s-sin(s))*cos(t)','(1-cos(s))*sin(t)','s',[-2*pi,2*pi]) ezsurf('x*exp(-x^2 - y^2)') ezsurfc('x*exp(-x^2 - y^2)')
- 19 -