西电matlab作业文档格式.docx
- 文档编号:15725953
- 上传时间:2022-11-15
- 格式:DOCX
- 页数:29
- 大小:153.54KB
西电matlab作业文档格式.docx
《西电matlab作业文档格式.docx》由会员分享,可在线阅读,更多相关《西电matlab作业文档格式.docx(29页珍藏版)》请在冰豆网上搜索。
-4.10001.0000
3.50004.0000
-3.30003.7000
-0.4000-4.4000
-5.0000-4.6000
4.2000-0.8000
0.60004.4000
3.90002.7000
-4.60001.5000
5.0000-3.2000
-2.70004.8000
-3.20004.6000
-3.70003.3000
4.2000-1.5000
1.0000-2.3000
2.4000-1.5000
-3.00000.5000
0.7000-0.5000
-4.10002.0000
3.2000-2.4000
2.40003.1000
3.5000-1.9000
3.60003.2000
-3.70001.3000
-0.8000-1.3000
-0.5000-2.8000
3.60004.2000
-3.5000-4.3000
-1.2000-2.8000
1.50000.1000
-0.10000.6000
1.00000.5000
4.20001.9000
2.6000-0.1000
3.8000-0.1000
3.2000-3.2000
2.6000-2.9000
6.利用randn函数产生均值为0,方差为1的10﹡10正态分布随机矩阵A,然后统计出A中大于-0.5且小于0.5的元素个数。
A=randn(10)
num1=sum((A(:
)>
-0.5)&
(A(:
)<
0.5))
-1.1878-1.18590.12860.8057-0.3306-0.11990.46941.0184-0.46501.5532
-2.2023-1.05590.65650.2316-0.8436-0.0653-0.9036-1.58040.37100.7079
0.98631.4725-1.1678-0.98980.49780.48530.0359-0.07870.72831.9574
-0.51860.0557-0.46061.33961.4885-0.5955-0.6275-0.68172.11220.5045
0.3274-1.2173-0.26240.2895-0.5465-0.14970.5354-1.0246-1.35731.8645
0.2341-0.0412-1.21321.4789-0.8468-0.43480.5529-1.2344-1.0226-0.3398
0.0215-1.1283-1.31941.1380-0.2463-0.0793-0.20370.28881.0378-1.1398
-1.0039-1.34930.9312-0.68410.66301.5352-2.0543-0.4293-0.3898-0.2111
-0.9471-0.26110.0112-1.2919-0.8542-0.60650.13260.0558-1.38131.1902
-0.37440.9535-0.6451-0.0729-1.2013-1.34741.5929-0.36790.3155-1.1162
num1=
38
第二次上机作业
第三章
1.重新产生图3.1。
x=0:
pi/20:
2*pi;
y=sin(x);
figure
(1)
plot(x,y,'
r-'
)
gridon
2.重新产生图3.2。
pi/50:
k=[1265176101];
x(k)=[];
subplot(2,2,1)
plot(x,sin(x)),gridon
subplot(2,2,2)
plot(x,cos(x)),gridon
subplot(2,2,3)
plot(x,tan(x)),gridon
subplot(2,2,4)
plot(x,cot(x)),gridon
3.重新产生图3.3。
title('
sin(\alpha)'
xlabel('
\alpha'
ylabel('
4.重新产生图3.4。
x=-2:
.1:
2;
y1=x.^2;
y2=x.^3;
plot(x,y1,'
x,y2,'
k.'
),gridon
legend('
\ity=x^2'
'
\ity=x^3'
y=x^2º
Í
y=x^3曲线'
x'
),ylabel('
y'
5.重新产生图3.5.
y1=sin(x);
y2=cos(x);
k-'
text(pi,0.05,'
\leftarrowsin(\alpha)'
text(pi/4-0.05,0.05,'
cos(\alpha)\rightarrow'
sin(\alpha)º
cos(\alpha)'
sin(\alpha)和cos(\alpha)'
6.重新产生图3.10。
x=[-5:
5];
y1=1./(1+exp(-x));
y2=(1-exp(-x)).*y1;
b.'
logsigº
函数'
tansig函数'
4)
多条曲线'
7.重新产生图3.12。
t=-pi:
pi;
y1=sin(t);
y2=2*cos(t);
plotyy(t,y1,t,y2),gridon
sin(t)andcos(t)'
text(0,0,'
\leftarrowsin(t)'
text(pi/2,0,'
\leftarrow2cos(t)'
8.重新产生图3.16。
程序:
t=0:
subplot(2,2,1),plot(sin(t),cos(t))
圆形轨迹'
subplot(2,2,2),plot(sin(t),2*cos(t))
椭圆形轨迹'
subplot(2,2,3),plot(sin(t),cos(t)),axissquare
title('
调整后的圆形轨迹'
subplot(2,2,4),plot(sin(t),2*cos(t)),axissquare,
调整后的椭圆形轨迹'
9.重新产生图3.17。
t=0:
[x,y]=meshgrid(t);
z=sin(x).*cos(y);
plot(t,z),axis([02*pi-11])
boxoff,axisoff
无坐标轴和边框图形'
10.重新产生图3.18。
x=[-pi:
pi];
y=exp(-2*sin(x));
绿色的标题(y=e^{-2sin(x)}'
Color'
g'
蓝色的x轴标注'
b'
蓝色的y轴标注'
text(-0.6,3.8,'
\leftarrow黑色的曲线标注'
k'
11.重新产生图3.19。
cmap=colormap;
L=length(cmap);
x=[1:
L];
y=x'
*ones(size(x));
bar(x(1:
2),y(1:
2,:
))
gray颜色板的颜色'
colormap('
gray'
12.重新产生图3.20。
loadspine
image(X)
colormapbone
人体脊骨图'
13.重新产生图3.21。
x=-2.9:
0.2:
2.9;
bar(x,exp(-x.*x),'
r'
Ì
õ
Ð
Î
¼
\ity=e^{-x^2}'
14.(课后题3)
x=-3:
3;
y1=2*x+5;
y2=x.^2-3*x+1;
figure
(1);
subplot(2,1,1);
plot(x,y1);
axis([-33-520]);
y1=2*x+5'
);
subplot(2,1,2);
plot(x,y2);
y2=x.^2-3*x+1'
15.(课后题5)
clearall
x1=-3:
0.01:
-1;
x2=-1:
1;
x3=1:
y1=(-x1.^2-4*x1-3)/2;
y2=-x2.^2+1;
y3=(-x3.^2+4*x3-3)/2;
plot(x1,y1);
holdon;
plot(x2,y2);
plot(x3,y3);
运行结果:
16.(课后题7)
x=[5288360200100];
explode=[01000];
colormaphsv;
labels={'
伙食费'
书本费'
话费'
衣服费'
其它'
};
pie(x,explode,labels)
17.(课后题9)
[x,y]=meshgrid(-10:
10);
z=x^2+y^2+sin(x*y);
c=ones(size(z));
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 作业