Matlab实验二.docx

上传人:b****2 文档编号:2766065 上传时间:2023-05-04 格式:DOCX 页数:24 大小:232.43KB
下载 相关 举报
Matlab实验二.docx_第1页
第1页 / 共24页
Matlab实验二.docx_第2页
第2页 / 共24页
Matlab实验二.docx_第3页
第3页 / 共24页
Matlab实验二.docx_第4页
第4页 / 共24页
Matlab实验二.docx_第5页
第5页 / 共24页
Matlab实验二.docx_第6页
第6页 / 共24页
Matlab实验二.docx_第7页
第7页 / 共24页
Matlab实验二.docx_第8页
第8页 / 共24页
Matlab实验二.docx_第9页
第9页 / 共24页
Matlab实验二.docx_第10页
第10页 / 共24页
Matlab实验二.docx_第11页
第11页 / 共24页
Matlab实验二.docx_第12页
第12页 / 共24页
Matlab实验二.docx_第13页
第13页 / 共24页
Matlab实验二.docx_第14页
第14页 / 共24页
Matlab实验二.docx_第15页
第15页 / 共24页
Matlab实验二.docx_第16页
第16页 / 共24页
Matlab实验二.docx_第17页
第17页 / 共24页
Matlab实验二.docx_第18页
第18页 / 共24页
Matlab实验二.docx_第19页
第19页 / 共24页
Matlab实验二.docx_第20页
第20页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Matlab实验二.docx

《Matlab实验二.docx》由会员分享,可在线阅读,更多相关《Matlab实验二.docx(24页珍藏版)》请在冰点文库上搜索。

Matlab实验二.docx

Matlab实验二

电子信息工程学系实验报告

成绩:

课程名称:

Matlab

指导教师(签名):

实验项目名称:

MATLAB语言绘图实验时间:

班级:

测控102姓名:

学号:

1实验目的

(1)学习MATLAB的各种二维绘图

(2)学习MATLAB的三维绘图

(3)MATLAB的绘图修饰

2实验内容

(1)基本二维绘图

1)向量绘图

x=0:

2*pi/100:

2*pi;

y1=sin(2*x);y2=cos(2*x);

plot(x,y1)

plot(x,y2)

plot(x,y1,x,y2)

plot(x,y1);holdon;

plot(x,y2);holdoff;

plot(x',[y1'y2'])

plot(x,y1,'c:

',x,y2,'ro')

figure

(1);plot(x,y1);

figure

(2);plot(x,y2);

subplot(2,2,1);plot(x,y1);

subplot(2,2,2);plot(x,y2);

subplot(2,2,3);plot(x,y1,x,y1+y2);

subplot(2,2,4);plot(x,y2,x,y1-y2);

2)函数绘图

fplot('sin',[04*pi])

f='sin(x)';fplot(f,[04*pi])

fplot('sin(1/x)',[0.010.1],1e-3)

fplot('[tan(x),sin(x),cos(x)]',[-2*pi,2*pi,-2*pi,2*pi])

3)符号函数快捷绘图

symsx

f=exp(-0.5*x)*sin(x);

ezplot(f,[0,10])

(2)多种二维绘图

1)半对数绘图

w=logspace(-1,1);

g=20*log10(1./(1+2*w*i));

p=angle(1./(1+2*w*i))*180/pi;

subplot(2,2,1);semilogx(w,g);grid;

Warning:

ImaginarypartsofcomplexXand/orYargumentsignored.

subplot(2,1,2);semilogx(w,p);grid;

2)极坐标绘图

t=0:

2*2*pi/180:

2*pi;

mo=cos(2*t);

polar(t,mo);

3)直方图

t=0:

2*pi/8:

2*pi;

y=sin(t);

bar(t,y)

4)离散棒图

t=0:

2*pi/8:

2*pi;

y=sin(t);

stem(t,y)

5)阶梯图

t=0:

2*pi/8:

2*pi;

y=sin(t);

stairs(t,y)

(3)图形注释

y1=dsolve('D2u+2*Du+10*u=0','Du(0)=1,u(0)=0','x');

y2=dsolve('D2u+2*Du+10*u=1','Du(0)=0,u(0)=0','x');

ezplot(y1,[0,5]);holdon;ezplot(y2,[0,5]);

axis([0,5,-0.1,0.2])

title('二阶系统时间响应');

xlabel('时间t');ylabel('响应幅值y');

gtext('零输入响应');

gtext('零状态响应');

grid;holdoff;

(4)三维绘图

1)三维线图

t=0:

pi/50:

10*pi;

plot3(sin(t),cos(t),t);

comet3(sin(t),cos(t),t);

2)单变量高度网线图

Z2=[11;1-1];

Z4=[Z2Z2;Z2-Z2];

Z8=[Z4Z4;Z4-Z4];

Mesh(Z8);

3)3变量马鞍面网线图

x=-4:

0.5:

4,y=x;

[X,Y]=meshgrid(x,y);

Z=X.^2-Y.^2;

Mesh(X,Y,Z);

x=

Columns1through9

-4.0000-3.5000-3.0000-2.5000-2.0000-1.5000-1.0000-0.50000

Columns10through17

0.50001.00001.50002.00002.50003.00003.50004.0000

Warning:

Couldnotfindanexact(case-sensitive)matchfor'Mesh'.

D:

\MATLAB\CD1\UP\toolbox\matlab\graph3d\mesh.misacase-insensitivematchandwillbeusedinstead.

Youcanimprovetheperformanceofyourcodebyusingexact

namematchesandwethereforerecommendthatyouupdateyour

usageaccordingly.Alternatively,youcandisablethiswarningusing

warning('off','MATLAB:

dispatcher:

InexactMatch').

4)圆锥面网线图

t1=0:

0.1:

0.9;

t2=1:

0.1:

2;

r=[t1-t2+2];

[X,Y,Z]=cylinder(r,40);

Mesh(X,Y,Z);

5)视角修饰

t1=0:

0.1:

0.9;

t2=1:

0.1:

2;

r=[t1-t2+2];

[X,Y,Z]=cylinder(r,30);

Mesh(X,Y,Z);

subplot(2,2,1);mesh(X,Y,Z);view(0,0);

subplot(2,2,2);mesh(X,Y,Z);view(-20,20);

subplot(2,2,3);mesh(X,Y,Z);view(-30,30);

subplot(2,2,4);mesh(X,Y,Z);view(-40,40);

实验心得:

 

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > IT计算机 > 计算机软件及应用

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2