You are on page 1of 13

Matlab http://www.iLoveMatlab.

cn

MATLAB ........................................................................................................................... 1
1.1 MATLAB ....................................................................................................................... 1
1..................................................................................................................................... 1
2............................................................................................................................. 1
3............................................................................................................................. 1
4..................................................................................................................... 1
5......................................................................................................................... 2
6.MATLAB .................................................................................................................. 2
1.2 MATLAB ....................................................................................................................... 2
1.3 MATLAB ............................................................................................................... 2
1.3.1MATLAB ................................................................................................................. 2
1.3.2 TheCommandWindow.............................................................................. 2
1.3.3 The History Command Window....................................................... 4
1.3.4 the launch pad........................................................................................... 4
1.3.5 Figure Windows ....................................................................................... 5
1.3.6MATLAB ............................................................................................................. 5
1.3.7MATLAB ................................................................................................................. 7
1.3.8 .............................................................................................................. 8
1.4 MATLAB ............................................................................................ 10
1.1................................................................................................................................... 10
1.5 ........................................................................................................................................... 11
1.5.1MATLAB ............................................................................................................... 11
1.6 ........................................................................................................................................... 11
1.1............................................................................................................................................ 11
1.2............................................................................................................................................ 11
1.3............................................................................................................................................ 11
1.4............................................................................................................................................ 11
1.5............................................................................................................................................ 12
1.6............................................................................................................................................ 12
1.7............................................................................................................................................ 12
1.8............................................................................................................................................ 12

Matlab http://www.iLoveMatlab.cn

MATLAB

MATLAB()

Matlab MATLAB
matlab
MATLAB
MATLAB MATLAB
1000
MATLAB

1.1 MATLAB
MATLAB

1.
MATLAB BASIC BASIC
MATLAB

MATLAB /

2.
MATLAB
windows98/2000/NT UNIX

MATLAB

3.
MATLAB

MATLAB

MATLAB

4.
MATLAB MATLAB
MATLAB

Matlab http://www.iLoveMatlab.cn

5.
MATLAB MATLAB

6.MATLAB
MATLAB MATLAB P
P VB MATLAB

1.2 MATLAB
MATLAB

MATLAB MATLAB
MATLAB C Fortan
5 10 MATLAB MATLAB

MATLAB MATLAB
MATLAB

1.3 MATLAB
1.3.1MATLAB
MATLAB

MATLAB
MATLAB
MATLAB
/
MATLAB
MATLAB MATLAB MATLAB
1.1 MATLAB
MATLAB
z The Command Window
z The Command History Window
z Launch Pad
z The Edit/Debug Window
z Workspace Browser and Array Editor
z Help Browser
z Current Directory Browser

1.3.2 TheCommandWindow
MATLAB (>>)

2.5m

Matlab http://www.iLoveMatlab.cn

the help browser

ATLAB Command Window

1.1ATLAB
>> area=pi*2.5^2
area =
19.6350
area
11 (TheCommandWindows), 1.2
MATLAB pi

Figure1.2 (The Command Windows)


3

Matlab http://www.iLoveMatlab.cn

...

x1=1+1/2+1/3+1/4+1/5+1/6;
And
x1=1+1/2+1/3+1/4 ...
+1/5+1/6;
(The Command Windows)
MATLAB (The Command Windows)
(Script files),(Script files)
.m M

1.3.3 The History Command Window


The History CommandWindow(The Command
Windows)

(The Command Windows)


Delete Section

1.3.4 the launch pad


MATLAB demos

Figure1.4 MATLAB
MATLAB MATLAB
MATLAB

M M M
M
File/New/M-file

M
File/Open

1.5 M
MATLAB
M

Matlab http://www.iLoveMatlab.cn

1.5 M

% this m-file calculates the area of a circle,


% and display the result
radius=2.5;
area=pi*2.5^2;
string=['the area of the circle is ' , num2str(area)];
disp(string);
M (The Command Windows) M
1.5
>>test
The area of the circle is 19.635

1.3.5 Figure Windows


MATLAB
(Script files) sinx

% this mfile calculates and plots the


% function sin(x) for 0<=x<=6.
x=0:0.1:6;
y=sin(x);
plot(x,y);
sin_x.m (The Command Windows)
(Script files)MATLAB
sinx

1.6 sinx

1.3.6MATLAB
z=10 z 10

Matlab http://www.iLoveMatlab.cn

M MATLAB
(The Command Windows)
(The Command Windows)(Script files)
MATLAB
(Script files)
whos M
calc_area sin_x
>> whos
Name
Size
Bytes Class
area
radius
string
x
y

1x1
1x1
1x32
1x61
1x61

8
8
64
488
488

double array
double array
char array
double array
double array

Grand total is 156 elements using 1056 bytes


(Script files)calc_area area,radius stringsin_x
x y(Script files)
(Script files)(Script files)
(The Command Windows)
string
>> string
string =
the area of the circle is 19.635
clear
clear var1,var2 ...
var1var2 clear variables clear

The workspace browser


GUI
MATLAB whos
The workspace browser

The workspace browser 1.7. whos

1.7 The workspace browser

Matlab http://www.iLoveMatlab.cn

Delete Delete

1.3.7MATLAB
MATLABhelpbrowser
MATLAB (TheCommand
Windows) helpdesk helpwin helpbrowser

MATLAB 1.9

1.8 ArrayEditor

ArrayEditor

Figure1.9
MATLAB (The
Command Windows) help help
(TheCommandWindows) helpMATLAB
help
lookfor lookfor help help
lookfor Lookfor
help
inverseofmatrix MATLAB inverse
help lookfor
>> lookfor inverse
INVHILB Inverse Hilbert matrix.
IPERMUTE Inverse permute array dimensions.
ACOS
Inverse cosine.
ACOSD Inverse cosine, result in degrees.
ACOSH Inverse hyperbolic cosine.

Matlab http://www.iLoveMatlab.cn

ACOT
Inverse cotangent.
ACOTD Inverse cotangent, result in degrees.
ACOTH Inverse hyperbolic cotangent.
ACSC
Inverse cosecant.
ACSCD Inverse cosecant, result in degrees.
ACSCH Inverse hyperbolic cosecant.
ASEC
Inverse secant.
ASECD Inverse secant, result in degrees.
ASECH Inverse hyperbolic secant.
ASIN
Inverse sine.
ASIND Inverse sine, result in degrees.
ASINH Inverse hyperbolic sine.
ATAN
Inverse tangent.
ATAN2 Four quadrant inverse tangent.
ATAND Inverse tangent, result in degrees.
ATANH Inverse hyperbolic tangent.
ERFCINV Inverse complementary error function.
ERFINV Inverse error function.
INV
Matrix inverse.
PINV
Pseudoinverse.
IFFT Inverse discrete Fourier transform.
IFFT2 Two-dimensional inverse discrete Fourier transform.
IFFTN N-dimensional inverse discrete Fourier transform.
IFFTSHIFT Inverse FFT shift.
inverter.m: %% Inverses of Matrices
DRAMADAH Matrix of zeros and ones with large determinant or inverse.
INVHESS Inverse of an upper Hessenberg matrix.
inv.

1.3.8
MATLAB (The Command
Windows) demo demos MATLAB
clc (The Command Windows) clf
The workspace browser clear
The workspace browser M

clear
abort M
control-c(^c)
c MATLAB ^c,

MATLAB
diary MATLAB

diary filename
(The Command Windows)
diary MATLAB
diary off diary diary on
MATLAB the MATLAB search path

Matlab http://www.iLoveMatlab.cn

MATLAB MATLAB M MATLAB M

MATLAB MATLAB

MATLAB

M MATLAB
M
MATLAB

MATLAB
MATLAB
M MATLAB

MATLAB M
MATLAB which

which filename
filename cross.m:
>> which cross
D:\MATLAB7\toolbox\matlab\specfun\cross.m
the path tool
(The Command Windows) editpath the path tool

1.10 the path tool

Matlab http://www.iLoveMatlab.cn

1.10

add path MATLAB


path MATLAB
path2rc MATLAB
rmpath MATLAB

1.4 MATLAB
MATLAB
(The Command Windows)+-*/^
r l

A=r2
1.1
V=Al.
0.1m 0.5m
MATLAB
>> A=pi*0.1^2
A =
0.0314
>> V=A*0.5
V =
0.0157
pi 3.1415926 A MATLAB V A

1.1

1.MATLAB /
2. MATLAB
3.
4. MATLAB
5. x = x0 + v0t +

1 2
at , MATLAB t=5s
2

x0 =10mv0 =15m/s a=-9.84m/s2.


6. x=3y=4 MATLAB

x2 y3
( x y) 2
MATLAB MATLAB 6.0
MATLAB
7.(The Command Windows) M calc_area.m sin_x.m( M
)
8. x plot(x,y)

10

Matlab http://www.iLoveMatlab.cn

1.5
MATLAB MATLAB
,MATLAB MATLAB
(The Command Windows)

/ M M

MATLAB help lookfor


MATLAB help
MATLAB
lookfor
MATLAB MATLAB
MATLAB M M
the path tool

1.5.1MATLAB
MATLAB

1.6
1.1
0.2 x

MATLAB y ( x) = 2e
[0,10]
x=0:0.1:10;y=2*exp(-0.2*x);plot(x,y);
MATLAB M test1.m
test1

1.2
exp
a help exp
b

1.3
lookfor

1.4
u=1 v=3, MATLAB
a.

4u
3v

b.

2v 2
(u + v) 2

c.

v3
v3 u 3

d.

4 2
v
3

11

Matlab http://www.iLoveMatlab.cn

1.5
MATLAB MATLAB

1.6
MATLAB
mynewdir.

1.7
mynewdir
% create an input array from -2*pi to 2*pi
t = -2*pi:pi/10:2*pi;
% calculate|sin(t)|
x=abs(sin(t));
%plot result
plot(t,x);
test2.m test2

1.8
test2

12

You might also like