You are on page 1of 35

www.wunan.com.

tw
(02)2705-5066

www.wunan.com.tw
(02)2705-5066


1984 MATLAB 2010 MATLAB
7.10MATLAB
MATLAB

CFortran
MATLAB

MATLAB

MATLAB
MATLAB MATLAB MATLAB

MATLAB MATLAB

MATLAB
MATLAB

www.wunan.com.tw
(02)2705-5066

www.wunan.com.tw
(02)2705-5066

MATLAB

1.1 MATLAB

1.2 MATLAB

1.3 MATLAB

1.3.1 MATLAB

1.3.2 MATLAB

1.3.3 MATLAB

13

1.3.4 MATLAB

14

1.3.5 MATLAB

20

MATLAB

21

2.1

22

2.1.1

22

2.1.2

26

2.2

28

2.2.1

28

2.2.2

29

2.2.3

30

2.3

33

2.3.1

33

2.3.2

33

www.wunan.com.tw
(02)2705-5066

2.3.3

35

2.3.4

36

2.3.5

40

2.4
2.4.1

46

2.4.2

47

2.5

48

2.5.1

48

2.5.2

53

2.5.3

54

2.5.4

58

2.6

45

61

2.6.1

62

2.6.2

65

2.6.3

67

2.6.4

71

3.1

73
74

3.1.1

74

3.1.2

75

3.1.3

76

3.1.4

78

3.1.5

81

3.1.6

83

3.1.7

84

3.2

85

www.wunan.com.tw
(02)2705-5066

3.2.1

86

3.2.2

87

3.2.3

89

3.2.4

90

93

4.1 MATLAB

94

4.2

95

4.2.1
4.2.2

4.3

95
100

103

4.3.1

103

4.3.2 M

104

4.3.3

105

4.4

107

4.4.1 rand()

107

4.4.2 size()

108

4.4.3 numel()

109

4.4.4 length() 109


4.4.5 mean()

110

4.4.6 reshape()

111

4.5

112

4.5.1

112

4.5.2

113

4.5.3 MATLAB

114

4.5.4

119

4.5.5

125

www.wunan.com.tw
(02)2705-5066

4.5.6

4.6

129

131

4.6.1

131

4.6.2

132

4.6.3

135

4.6.4

137

4.6.5

139

4.6.6

141

145

5.1

146

5.2

146

5.2.1

146

5.2.2

148

5.3

149

5.3.1

149

5.3.2

151

5.4

153

5.5

155

5.5.1

155

5.5.2

156

5.5.3

158

5.6

160

5.7

163

5.7.1

164

5.7.2

167

www.wunan.com.tw
(02)2705-5066

5.8

169

5.8.1

169

5.8.2

170

5.8.3

172

5.8.4

173

5.8.5

174

6.1

177
178

6.1.1

178

6.1.2

179

6.1.3

181

6.2

182

6.3

183

6.3.1

183

6.3.2

183

6.3.3

185

6.3.4

189

6.3.5

191

6.3.6

192

6.3.7

197

6.4

201

6.5

206

6.5.1

206

6.5.2

208

6.5.3

209

6.6

210

www.wunan.com.tw
(02)2705-5066

6.6.1

210

6.6.2

213

6.6.3

215

6.7

218

MATLAB

223

7.1

224

7.1.1 plot()

224

7.1.2

228

7.1.3

230

7.1.4

232

7.1.5

233

7.1.6 plotyy()

236

7.1.7 Easy

239

7.2

242

7.2.1

242

7.2.2

243

7.2.3

245

7.2.4

247

7.3

248

7.3.1

248

7.3.2

249

7.3.3

251

7.3.4

252

7.3.5

253

7.3.6

254

7.3.7

255

7.3.8

256

www.wunan.com.tw
(02)2705-5066

7.4
7.4.1

257

7.4.2

258

7.4.3

260

7.5

257

261

7.5.1

261

7.5.2

262

7.5.3

263

MATLAB

265

8.1

266

8.1.1

266

8.1.2

269

8.1.3

273

8.2

277

8.2.1 continue

277

8.2.2 break

278

8.2.3 return

279

8.2.4 keyboard

279

8.2.5 error() warning()

281

8.3

281

8.3.1

281

8.3.2

282

8.3.3

286

www.wunan.com.tw
(02)2705-5066

M
9.1 M

288

9.1.1 M

288

9.1.2 M

290

9.1.3

296

9.1.4

298

9.1.5

300

9.2

10

287

308

9.2.1

308

9.2.2

308

GUI

309

10.1 GUI

310

10.2 GUI

310

10.2.1

311

10.2.2

313

10.3

314

10.3.1

314

10.3.2

315

10.3.3

316

10.3.4

319

10.3.5

320

10.3.6

320

10.4
10.4.1

322
322

www.wunan.com.tw
(02)2705-5066

10.4.2

327

10.4.3

331

10.5 GUIDE

11

334

10.5.1 GUIDE

334

10.5.2 GUIDE GUI

336

Simulink

343

11.1 Simulink

344

11.2 Simulink

346

11.2.1 Simulink

346

11.2.2

347

11.2.3

350

11.3 Simulink

353

11.3.1 Source

354

11.3.2 Sinks

358

11.3.3

359

11.4 Simulink

360

11.4.1

360

11.4.2

361

11.4.3

367

11.5 Simulink

371

11.5.1

372

11.5.2

373

11.6 Simulink S-()

376

11.6.1 S-()

376

11.6.2 M S-()

378

www.wunan.com.tw
(02)2705-5066

11.7 Simulink

12

384

11.7.1

384

11.7.2

386

11.7.3

387

MATLAB
12.1 MATLAB

389
390

12.1.1

390

12.1.2

391

12.2 MATLAB

393

12.2.1

393

12.2.2

395

12.3 MATLAB

396

399

www.wunan.com.tw
(02)2705-5066

MATLAB

MATLAB MATLAB MATLAB


MATLAB MATLAB
MATLAB
MATLAB


1.1MATLAB
1.2MATLAB
1.3MATLAB

www.wunan.com.tw
(02)2705-5066

MATLAB

1.1MATLAB
MATLAB Matrix Laboratory M athWorks MATLAB M athematica M aple

20 70 Cleve Moler FORTRAN


MATLAB 1984 LittleMolerSteve Bangert MathWorks MATLAB 20 90 MATLAB

MATLAB

MATLAB

MATALB
MATALB

1.2MATLAB
MATLAB W indows 1 -1 M ATLAB MATLAB
MATLAB
MATLAB MATLAB 7.10 MATLAB Windows XP
1. setup.exe

(02)2705-5066

www.wunan.com.tw

1.2MATLAB
1-1MATLAB

MATLAB 1.0

1984

MATLAB 7.3

R2006b

2006

MATALB 2.0

1986

MATLAB 7.4

R2007a

2007

MATLAB 4.2c

R7

1994

MATLAB 7.5

R2007b

2007

MATLAB 5.0

R8

1996

MATLAB 7.6

R2008a

2008

MATLAB 6.0

R12

2000

MATLAB 7.7

R2008b

2008

MATLAB 7.0

R14

2004

MATLAB 7.8

R2009a

2009

MATLAB 7.1

R14SP3

2005

MATLAB 7.9

R2009b

2009

MATLAB 7.2

R2006a

2006

MATLAB 7.10

R2010a

2010

1-1 MATLAB 7.10

1-1

2. Install without using the InternetNext


1-2 Yes
Next 1-3

www.wunan.com.tw 
(02)2705-5066

MATLAB

1-2

1-3

3. Next
Typical Custom 1-4 Typical
Custom
TypicalNext
1-5

1-4


(02)2705-5066

www.wunan.com.tw

1.2MATLAB

1-5

4. Next MATLAB
1-6 Install MATLAB 1-7

1-6

1-7

www.wunan.com.tw 
(02)2705-5066

MATLAB
5. MATLAB
Finish

1.3MATLAB
MATLAB MATLAB
MATLAB

1.3.1MATLAB
MATLAB MATLAB
1-8

1-8MATLAB

MATLAB Command Window


>> MATLAB

[3+sin(/2)]2+3 2

(02)2705-5066

www.wunan.com.tw

1.3MATLAB
>>[3+sin(pi/2)]/2+3^2

ans =
11

ans answer MATLAB

1.3.2MATLAB
MATLAB MATLAB MATLAB
Start

M
MATLAB
1.
MATLAB W indows
MATLAB 7
1-9 File
EditDebug
ParallelDesktop
Window
Help

1-9

www.wunan.com.tw 
(02)2705-5066

MATLAB
2. Command Window
MATLAB
MATLAB MATLAB
UnDock Command Window
DesktopUndock Command Window
1-10 M ATLAB
Dock Command Window Desktop
Dock Command Window

1-10Command Window

FilePreference

OkMATLAB
MATLAB

MATLAB
MATLAB >> MATLAB
EnterMATLAB

Enter
Enter


(02)2705-5066

www.wunan.com.tw

1.3MATLAB

x =1y =3 z =x /y
x=1, y=3, z=x/y

x=
1
y=
3
z=
0.3333

M AT L A B
Short MATLAB
z 0.3333

FilePreferenceCommand WindowPreferencesNumeric formatNumeric display


1/3
1-2
reshape()
4

www.wunan.com.tw 
(02)2705-5066

MATLAB
1-2

4 7 1000

format short

0.3333

format long

0.333333333333333

15

format short e

3.3333e-001

format long e

3.333333333333333e-001 15

format short g

0.33333

format shor t format short e

format long g

0.333333333333333

format long t format long e

format hex

3fd5555555555555

format bank

0.33

format +

+-

format rat

1/3

format compact -----

format loose

---

A =

B =reshapeA , 2, 2, 3

A=[1 2 3 4 ; 5 6 7 8 ; 9 10 11 12]
>> B=reshape (A,2,2,3)

A=
1 23 4
5 67 8
9

10 11 12

B( : , : , 1) =
1 9
5 2

10

(02)2705-5066

www.wunan.com.tw

1.3MATLAB
B( : , : , 2) =
6 3
10 7
B( : , : , 3) =
11 8
412

3. Command History Window

Evaluate Selection

M 1-11

1-11

diary log()

dairy off()

4. WorkspaceBrowser

www.wunan.com.tw 11
(02)2705-5066

MATLAB
who whos
ViewChoose Columns
1-12
Plot all columnsWorkspace

1-12

5. CurrentFolder
MATLAB

Browse for folder

Go up one level

1-13

12

(02)2705-5066

www.wunan.com.tw

1.3MATLAB

1-13 1-14M

6. M Editor / Debugger

M
M M ATLAB New Script
Open file M 1-14
M

FileSave

DebugRun M

1.3.3MATLAB
MATLAB

1-3

www.wunan.com.tw 13
(02)2705-5066

MATLAB
1-3

addpath

addpath ()

MATLAB

help

Help

MATLAB M

version

Version

MATLAB

disp(X)

disp(X)

length

length(X)

load

Load

openvar

openvar(name)

save

save

size

size(X)

who

who

whos

whos

workspace

workspace

clc

clc

format

format

home

home

MATLAB

cd

cd

delete

delete filename

diary

diary
diary off

diary

dir

dir

edit

edit

open

open(name)

quit

quit

MATLAB

1.3.4MATLAB
MATLAB
MATLAB
PDF MATLAB

14

(02)2705-5066

www.wunan.com.tw

1.3MATLAB
MATLAB
1. MATLAB
MATLAB
HelpWeb Resources
1-15 MathWorks http://www.mathworks.com

2. MATLAB
MATLAB MATLAB
MATLAB 4
Help ?
StartHelp
DesktopHelp
helpwinhelpdesk doc

1-15

MATLAB 1-16

www.wunan.com.tw 15
(02)2705-5066

MATLAB

1-16MATLAB

MATLAB Comment
Comment
SearchResult
3. MATLAB
MATLABMATLAB
Demo Demo
Demo 1-17
Video
4.
MATLAB

1 MATLAB Help
Help MATLAB

16

(02)2705-5066

www.wunan.com.tw

1.3MATLAB

1-17MATLAB
HELP topics:
My Documents\MATLAB

- (No table of contents file)

matlab\general

- General purpose commands.

matlab\ops

- Operators and special characters.

atlab\lang

- Programming language constructs.

matlab\elmat

- Elementary matrices and matrix manipulation.

matlab\randfun

- Random matrices and random streams.

matlab\elfun

- Elementary math functions.

matlab\specfun

- Specialized math functions.

matlab\matfun

- Matrix functions - numerical linear algebra.

matlab\datafun

- Data analysis and Fourier transforms.

matlab\polyfun

- Interpolation and polynomials.

matlab\funfun

- Function functions and ODE solvers.

matlab\sparfun

- Sparse matrices.

matlab\scribe

- Annotation and Plot Editing.

matlab\graph2d

- Two dimensional graphs.

matlab\graph3d

- Three dimensional graphs.

matlab\specgraph

- Specialized graphs.

matlab\graphics

- Handle Graphics.

www.wunan.com.tw 17
(02)2705-5066

MATLAB
matlab\uitools

- Graphical User Interface Tools.

matlab\strfun

- Character strings.

matlab\imagesci

- Image and scientific data input/output.

matlab\iofun

- File input and output.

matlab\audiovideo

- Audio and Video support.

matlab\timefun

- Time and dates.

2 MATLAB help help help

help help
HELP Display help text in Command Window.
HELP, by itself, lists all primary help topics. Each primary topic
corresponds to a directory name on the MATLABPATH.

3 help FunName
eye() MATLAB
help eye

eye()
EYE Identity matrix.
EYE(N) is the N-by-N identity matrix.
EYE(M, N) or EYE([M, N]) is an M-by-N matrix with 1s on
the diagonal and zeros elsewhere.
EYE(SIZE(A)) is the same size as A.
EYE with no arguments is the scalar 1.
EYE(M, N, CLASSNAME) or EYE([M, N], CLASSNAME) is an M-by-N matrix with 1s of
class CLASSNAME on the diagonal and zeros elsewhere.

18

(02)2705-5066

www.wunan.com.tw

1.3MATLAB
Note: The size inputs M and N should be nonnegative integers.
Negative integers are treated as 0.
Example:
x = eye(2, 3, int8);
See also speye, ones, zeros, rand, randn.
Overloaded methods:
distributed/eye
codistributor2dbc/eye
codistributor1d/eye
codistributed/eye
Reference page in Help browser
doc eye

4 l ookfor

lookfor name

name
lookfor fe
cdfepoch

- Construct epoch object for CDF export.

TargetsComms_CommsBuffer

- class to create a buffer with specific units and


size

TargetsMemory_MemoryBuffer

- Class representing a Memory Buffer for

fec

- Forward error control code implementation.

tf

- Creation of transfer functions or conversion to


transfer function.

sdemrd

- Stochastic differential equation (SDE) from


mean-reverting drift rate

diffusion

- Diffusion rate class file of stochastic differential


equations.

drift

- Drift rate class file of stochastic differential equations.

www.wunan.com.tw 19
(02)2705-5066

MATLAB
sde

- Stochastic differential equation (SDE) class file.

sdeddo

- Stochastic differential equation (SDE) from Drift


and Diffusion objects.

sdeld

- Stochastic differential equation (SDE) from linear


drift rate.

rptfpmethods

- A reference object for Simulink Fixed Point

mbcreference

- Construct a new mbcreference object

cgexprmodel

- internal class for feature models in CAGE

cgfeature

- Constructor for cgfeature class

cgifexpr

- Constructor for the cgifExpr class

1.3.5 MATLAB
MATLAB
ode

MATLAB

MATLAB

MATLAB
MATLAB MATLAB MATLAB

MATLAB MATLAB

MATLAB MATLAB

20

(02)2705-5066

www.wunan.com.tw

MATLAB.
. , 2012.06

ISBN 978-957-11-6697-1 ()
1.MATLAB
312.49

101009213

5DE7

MATLAB









106 3 3 9 4
(02)2705-5066(02)2706-6100
http://www.wunan.com.tw
wunanwunan.com.tw
0 1 0 6 8 9 5 3

/6
(04)2223-0891(04)2223-3549
/290
(07)2358-702 (07)2350-236

2 0 1 2 6


5 2 0

(02)2705-5066

www.wunan.com.tw