实验一MATLAB操作基础实验报告

  • 格式:doc
  • 大小:41.50 KB
  • 文档页数:5

下载文档原格式

  / 5
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

闽 江 学 院 电 子 系 实 验 报 告

学生姓名:

班级:

学 号:

课程:MATLAB 程序设计

一、 实验题目:MATLAB 操作基础 二、 实验地点:实验楼A210 实验目的:

1、熟悉MATLAB 的操作环境及基本操作方法。

2、掌握MATLAB 的搜索路径及其设置方法。

3、熟悉MATLAB 帮助信息的查阅方法。

三、 实验内容:

1、先建立自己的工作目录,再将自己的工作目录设置到MATLAB 搜索路径下,再试验用help 命令能否查询到自己的工作目录。

2、在MATLAB 环境下验证例1-1至1-4,并完成以下题目: (1)绘制右图所示图形 (2)求38

3、利用MATLAB 的帮助功能分别查询inv ,plot 、max 、round 等函数的功能及用法。

4、在工作空间建立一个变量a ,同时在当前目录下建立一个M 文件:a.m ,试在命令窗口输入a ,观察结果,并解释原因。

四、 实验环境(使用的软硬件): MATLAB 7.0 五、 实验结果:

实验程序: (1)求38。

程序: x=8;

plot(x, x^(1/3));

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-1-0.8-0.6-0.4-0.200.20.40.60.81

得到的结果: ans= 2

(2)绘制图像 程序:

x=[0:0.001:1];

plot(x, sin(2*pi*x),x, 2*x-1,x,0); 得到结果如下图:

(3)查询plot 、inv 、round 、max 等函数的功能及用法 分别输入:

输入:help plot 得到:

PLOT Linear plot.

PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up. If X is a scalar and Y is a vector, length(Y) disconnected points are plotted.

PLOT(Y) plots the columns of Y versus their index.

If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)). In all other uses of PLOT, the imaginary part is ignored.

Various line types, plot symbols and colors may be obtained with

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-1-0.8-0.6-0.4-0.200.20.40.60.81

PLOT(X,Y,S) where S is a character string made from one element

from any or all the following 3 columns:

b blue . point - solid

g green o circle : dotted

r red x x-mark -. dashdot c cyan + plus -- dashed m magenta * star

y yellow s square

k black d diamond

v triangle (down)

^ triangle (up)

< triangle (left)

> triangle (right)

p pentagram

h hexagram

For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus at each data point; PLOT(X,Y,'bd') plots blue diamond at each data point but does not draw any line.

PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by the (X,Y,S) triples, where the X's and Y's are vectors or matrices and the S's are strings.

For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a solid yellow line interpolating green circles at the data points.

The PLOT command, if no color is specified, makes automatic use of the colors specified by the axes ColorOrder property. The default ColorOrder is listed in the table above for color systems where the default is blue for one line, and for multiple lines, to cycle

through the first six colors in the table. For monochrome systems, PLOT cycles over the axes LineStyleOrder property.