1 / 12
文档名称:

Franco 2002 Matlab Tutorial.pdf

格式:pdf   页数:12
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Franco 2002 Matlab Tutorial.pdf

上传人:kuo08091 2014/3/21 文件大小:0 KB

下载得到文件列表

Franco 2002 Matlab Tutorial.pdf

文档介绍

文档介绍:Matlab® Tutorial
Francesco Franco


Matlab® is a software package that makes it easier for you to enter matrices and vectors, and
manipulate them. The interface follows a language that is designed to look like the notation used
in linear algebra.
This tutorial guides you in the first steps for using Matlab®. Start the program, The main window is
subdivided in three windows. mand Window is the one where you enter mands
(after a >> which is used to denote mand line).

I

Vectors : Almost all of Matlab® mands revolve around the use of vectors. To
simplify the creation of vectors, you can define a vector by specifying the first entry, an
increment, and the last entry. Matlab® will automatically figure out how many entries you need
and their values. For example, to create a vector whose entries are 1,3,5,7, type the following
>> 1:2:7

ans =

1 3 5 7


Matlab® keeps track of the last result. In the previous example a variable “ans” is created. To
look at the transpose of the previous result, enter the following (‘ is the transpose operator):
>> ans'

ans =

1
3
5
7
To be able to keep track of the vectors you create, you can give them names. To create a row
vector v:
>> v=[1:2:7]

v =

1 3 5 7

>> v

v =

1 3 5 7
If you add a semi-colon (;) at the end of mand line, the result is not displayed. Matlab®
will allow you to look at specific parts of the vector, thus to work with the first 3 elements of
v:

>> v(1:3)

ans =

1 3 5
Once you master the notation you are free to perform other operations:

>> v(1:3)-v(2:4)

ans =

-2 -2 -2

Defining a matrix is similar to defining a vector. To define a matrix, you can treat it like a column
of row vectors (note that the spaces are required!):

>> A= [ 1 2 3; 3 4 5; 6 7 8]

A =

1 2 3
3 4 5
6 7 8

You can also treat it like a row of column vectors: