Anda di halaman 1dari 73

MATLAB

2004


MATLAB

2004

681.3.082 (076)
32.97.7
17

, . .
-

MATLAB:
17 01719, 351400
/. . . . , , 2004. 72.

.

MATLAB.
,
, ,
MATLAB. .
01719,
351400 , , .
681.3.082 (076)
32.97.7


MATLAB

:
. .
27.02.2004. 6084/16.
. . . . . 4,18.
.-. . 3,98. 100 .
.

432027, , . , 32.
, 432027, , . , 32.

, 2004

1.
Simulink
Simulink ,
.
-, ,
. Simulink
MATLAB,
. Simulink
Stateflow ,
. Simulink
,
.


Simulink MATLAB.
Simulink,
, ,

. ,
,
,
, , , ,
, .
Simulink MATLAB,
MATLAB
. , MATLAB
Simulink.
,
Simulink (, LTI-Viewer Control System Toolbox
).
(, Power
System Blockset , Digital
Signal Processing Blockset
.).
Simulink
, ,
.

,

( ).
, .
,
Simulink.
.
Simulink ,
,
MATLAB, + +, Fortran Ada.

2.
2.1.
Simulink
. ,
.
, Simulink
.
Simulink
:
1) File/New/Model,
( ,

/, ,
).
. 2.1.

2.1.

2) .
(, Sources - ).
,
.
. . 2.2 ,
.

2.2. ,

(
), Delete
.
,
, ,
( ).
3) , , ,
.
,
.
. ,
,
. OK.
. 2.3 ,
.

2.3. ,

4) ,
.
, , ,
, .
. ,
.

, , .
5)
, File/Save As...
. ,
32 ,
.
( , ).

Fille/Save. Simulink
File/Open...
MATLAB.
( ,
) Delete .

, ,
. 2.4.

2.4.

2.2.
(. . 2.4):
1. . (
Untitled )
2. File, Edit, View ..
3. .
4. .
5. ,
.
,
, ..:
File () .
Edit () .
View () .
Simulation ()
.
Format ()
.
Tools ( )
(, ..)
Help () .


(. 2.5).

2.5.

:
1. New Model () .
2. Open Model mdl-.
3. Save Model mdl- .
4. Print Model - .
5. Cut
.
6. Copy
.
7. Paste
.
8. Undo .
9. Redo .
10. Library Browser .
11. Toggle Model Browser .
12. Go to parent system
( ).
.
13. Debug .
14. Start/Pause/Continue Simulation

( Start);

, Pause (
);
,
Continue ().
15. Stop .
, Pause.
16. Normal/Accelerator / .
, Simulink Performance Tool.
,
,
,
.
Simulink: Ready () Running ().
:
8

- ( ,
100%),
(
),
(
),
( ).

3.

3.1.

.
.
.
. . 3.1
.
, (Simulink 4)
,
: ,
, ,
. ,
Simulink .

P 3.1. Transfer Function

3.2.
- (,
, )
.
.

. .
(. . 3.1).
. ,
, , .
,
.
. ,
Edit/Select All.
Clear
Edit (. 3.2).
, ,
.

. 3.2.


.
Paste File Simulink
() .

10

, Clear ,
.
File / Undo Simulink.

3.3.
Simulink
. ,
, ,
. ,

, , ,
Simulink.
.
.
. ,
,
.
,
. . ,
- . .
,
.
. ,
(. 3.3),
.

. 3.3.

,
.
. ,
,
(. 3.4).

11

. 3.4.


.
, . . 3.5
.

. 3.5.

.
. 3.6.

. 3.6.


Shift. . 3.7.

. 3.7.

12


.
. 3.8. ,
Shift .
, . 3.8, ,
.
, ,
,
.
, .

. 3.8.

,
.
. 3.9.

. 3.9.

13

,
.
() ,
. 0,
.
, , ,
( ) ,



Clear Cut.


Simulink -.
,
, . ,
.
,
,
(. 3.10)

. 3.10.

. 3.11.
, () ,
.

. 3.11.
14


, , ,
, , .
, .
,

.
.
3.12

. 3.12.


. 3.13.

. 3.13.

,
, .
,
,
,
.
Edit/Clear.
.


,
, 1
15

.
. 3.14.

. 3.14.

, ,
.
(
, sin(x) cos(x)).

t " 0 1, 0.
,
. ,
. ,

90 .
, (. 3.9)
.
, . 3.14, .

Undo Redo
Undo
. ,
.

Edit. one Redo.
16

3.4.
Format ( ,
)
.
:
1. :
Font .
Text alignment .
Flip name .
Show/Hide name .
2. :
Foreground color .
Background color .
Screen color .
3. :
Flip block
.
0
Rotate block 90 .
Show drop shadow .
Show port labels .
4. :
Library link display .
Sample time colors .
Wide nonscalar lines /
.
Signal dimensions .
Port data types .
Storage class (,
Real-Time Workshop).
Execution
order
.
Format/Font
(. 3.15).

17

. 3.15.

, . 3.17
,
. ,
View/Zoom In.

. 3.17.

,
,
.

4.


.
Simulation/Parameters.
.4.1.
18

4.1.

4 :
Solver () .
Workspace I/O (/ )
MATLAB.
Diagnostics ()
.
Advanced () .

, Solver.
(. 4.1):
Simulation time ( , , ,
),
Solver options ( ),
Output options ( ).

4.1.
4.1.1. Simulation time (
)
(Start time)
(Stop time) . , ,
19

.
.

4.1.2. Solver options ( )



(Type) .
Type c (Fixed-step)
(Variable-step) . , Variable-step
, a Fixed-step
.

. (discrete)
. .
(Variable-step)
(Fixed-step) , , ,
.

MATLAB.
Type ,

. Fixed-step
Fixed-step size ( ),
(. . 4.2).

4.2. Solver
20


(auto).
auto , (

).
Fixed-step (Mode).
Mode :
MultiTasking () ,
,
.
,
.
SingleTasking () ,

.
Auto
( ) Simulink
MultiTasking ,

SingleTasking ,
, .
Variable-step
:
step size .
(auto)
(SfopTime StartTime)/50.
,
( ) .
.
in step size .
Initial step size .

: (Relative
tolerance) (Absolute tolerance).
10-3 auto.

4.1.3. Output options ( )


Solver
(Output options).
:
Refine output ( )
,
21

MATLAB
Workspace.
Refine factor, .
Refine factor 1, ,
Dt = 1 (
). Refine factor 2,
, 3 . . Refine
factor .
Produce additional output ( )

; (
Output times) ,
. (Dt)
1. Output times
.
Produce specified output only ( )

, Output times (
).

4.2.
,
MATLAB ,
Workspace I/O (. 4.3).

4.3. Workspace I/O


22

3 :
Load from workspace ( ). Input
( ) ,
,
MATLAB. Initial State ( )
,
. ,
Input Initial State,
In ( Sources).
Save to workspace ( )
MATLAB
.
Save options ( )
. Limit rows to last
,
( ).
, . Decimation
()
( Refine factor Solver). Format
( ) .
Array (), Structure (), Structure
With Time ( ).

4.3.
Diagnostics (. 4.4)
, Simulink
MATLAB,
.
,
Simulink
MATLAB.
Diagnostics.
,
Action ( ,
):
None ,
Warning ,
Error .

23

4.4. Diagnostics

4.4.

Simulation/Start.
.
, Simulation/Stop
. (Simulation/Pause)
(Simulation/Continue).

5. Simulink
5.1. Sources -
5.1.1. Constant
:
.
:
1. Constant value .

24

2. Interpret vector parameters as 1-D


( ).
Simulink.
.

, , .
. 5.1.1
Display.

. 5.1.1. Constant

5.1.2. Step
:
.
:
1. Step time ().
2. Initial value .
3. Final value .
(
), ( ).

, (,
5 3).
. 5.1.2. .

25

. 5.1.2. Step

5.1.3. Signal Generator


:
:
1. sine .
2. square .
3. sawtooth .
4. random .
:
1. Wave form .
2. Amplitude .
3. Frequency (/).
4. Units . :
Hertz .
rad/sec /.
. 5.1.3.
.

5.1.4.
Uniform Random Number
:
.
:
1. Minimum .
2. Maximum .
3. Initial seed .

26


. 5.1.4.

. 5.1.3.

. 5.1.4.

5.1.5.
Random Number
:

.
27

:
1. Mean
2. Variance ( ).
3. Initial seed .

. 5.1.5.

5.1.6. Pulse Generator

1.

2.
3.
4.

5.

6.

:
.
:
Pulse Type .
:
Time-based .
Sample-based
.
Amplitude .
Period . Time-based Pulse Type
Sample-based Pulse Type.
Pulse width .
Time-based Pulse Type
Sample-based Pulse Type.
Phase delay . Time-based
Pulse Type Sample-based Pulse
Type.
Smple time . Sample-based Pulse
Type.
28

. 5.1.6.

5.1.7. Clock

:
,
.
:
1. Decimation ,
( ,
Display time). .
, Simulation parameters
0,01 , Decimation Clock
1000,
10 .

. 5.1.7.
29

2. Display time .
. 5.1.7 .

5.1.8. Digital Clock


:
.
:
Sample time ().
. 5.1.8 Digital Clock

. 5.1.8.

5.2. Sinks -
5.2.1. Scope
:
.
.

. 5.2.1.

30

. 5.2.1. Scope

,
.
( , ,
). ,
,
.

(. 5.2.2).

. 5.2.2. Scope

11 :
1. Print .
2. Parameters .
3. Zoom .
4. Zoom X-axis .
5. Zoom Y-axis .
6. Autoscale .
7. Save current axes settings .
8. Restore saved axes settings .
9. Floating scope .
10. Lock/Unlock axes selection /
.
, Floating scope.
31

11. Signal selection . ,


Floating scope.

:

)
1. ( ,
. 2,5
.
2. ( , ) ,
,
. . 9.2.3 .

. 5.2.3. .

3.
Axes properties . ,
Y-min Y-max
.
(Title), %<SignalLabel>
. . 5.2.4.

. 5.2.4. .

32

:
Scope parameters,
(Parameters) .
:
General .
Data history
MATLAB.
. . 5.2.5.

. 5.2.5. General.

General :
1. Number of axes ( ) .

.
2. Time range ,
.
Time range, ,
Time
range.
3. Tick labels / .
( ):
all ,
none ,
bottom axis only
.
4. Sampling .
. Decimation
33

,
. . 5.2.6 5.2.7
0.1 . . 5.2.6
Scope ( Decimation 1).
. 5.2.7 (
Decimation 2). .

. 5.2.6. (Decimation = 1).

. 5.2.7. (Decimation = 2).

34

, Sample
time,
. . 5.2.8 ,
, Sample time 0,1.

. 5.2.8. (Sample time = 0,1).

5. floating scope (
).
Data history (. 5.2.9) :
1. Limit data points to last
.
. , Limit data
points to last , Simulink
.
2. Save data to workspace
MATLAB.
3. Variable name
MATLAB.
4. Format MATLAB.
:
Array ,
Structure ,
Structure with time .

35

. 5.2.9. Data history.

5.2.2. Graph
:
( Y(X)).
:
x-min X.
x-max X
y-min Y.
y-max Y
Sample time .
. ,
(X),
(Y).
. 5.2.10, ,
.

.
Clock.
. 5.2.11.

5.2.3. Display
:
.
:
1. Format . Format
:
short 5 .
36

. 5.2.10. Graph.

long 15 .
short_e 5 3 .
long_e 15 3 .
bank .
.
2. Decimation .
Decimation = 1 ,
Decimation = 2 , Decimation = 3
..
3. Sample time .
.
4. Floating display () .
,

.
Signal storage reuse off (
Advanced Simulation parameters). . 5.2.12
Display
Format.

37

. 5.2.11. Graph
.

Display
, , . . 5.2.13
.
, ,
(. Display4 . 5.2.13).

. 5.2.12. Display
Format.
38

. 5.2.13 Display ,
.

2.4. Stop Simulation


:
,
.
:
.
Simulink
, .
, ,
. . 5.2.14
. ,
Transfer Function
0,99.

. 5.2.14. Stop Simulation

39

5.3. Continuous
5.3.1. Memory
:
.
:
Initial condition .
Inherit sample time () .
, Memory
(Sample time) , .
. 5.3.1 Memory
.

5.3.2. Transport Delay


:
.
:
1. Time Delay ( ).
2. Initial input .

. 5.3.1.

3. Buffer size ,
. , ( 1024).

40

4. Pade order (for linearization) ,


.
.
,
Transport
Delay.
. ,

, Transport Delay
.
,
, Simulink
.
MATLAB .
. 5.3.2 Transport Delay
0,5 .

. 5.3.2. Transport Delay .

5.4. Discrete
5.4.1. Unit Delay
:
41

.
:
1. Initial condition .
2. Sample time .
, .

.
.
. 5.4.1
, 0,1.

5.4.1. Discrete-Time Integrator


:

.
:
1. Integration method :
Forward Euler .
T/(z-1) 1/s.
:
y(k) = y(k1) + T*u(k1),
y ,
u ,
T ,
k .

. 5.4.1. Unit Delay

42

Backward Euler .

Tz/(z1) 1/s.
:
y(k) = y(k1) + Tu(k).
Trapeziodal .
T/2(z+1)/(z1)
1/s. :
x(k) = y(k1) + T/2 u(k1).
2. Sample time .
,
Integrator ( Continuous).
. 5.4.2
Discrete-Time Integrator.
,
.

. 5.4.2.
.

43

Discrete-Time

Integrator,

5.5. Nonlinear -
5.5.1. Switch
:
.
:
Threshold .
:
, , ,
Threshold,
() .
,
() .
. 5.5.1 Switch. ,
1,
, ,
Ground.
0,5.

. 5.5.1. Switch

5.5.2. Multiport Switch


:

44

,
.
:
Number of inputs .
Multiport Switch,
,
.
, Multiport Switch
, Matlab
.
. 5.5.2 Multiport Switch.

Constant, Step, Step1 Sum. Multiport
Switch, ,
, .

. 5.5.2. Multiport Switch.

Multiport Switch 1.
,
,
.

45

5.5.3. Manual Switch


:
.
:
.

. ,
, .
,
.
. 5.5.3 Manual Switch.

. 5.5.3. Manual Switch.

5.6. Math
5.6.1. Abs
:
.
:
Saturate on integer overflow () .

.
Abs,
, . 5.6.1.
Abs
. . 5.6.2
:
.

46

. 5.6.1. Abs

, , 1
.

. 5.6.2. Abs

47

5.6.2. Sum
:
.
:
1. Icon shape . .
round ,
rectangular .
2. List of sign .
: + (), - () | ( ).
3. Saturate on integer overflow ()
.
.
( )
List of sign,
. List of sign
. .
,
Sum .
,
. .
, ,
.
, ,
.
.
1 ( ),
.
Sum . 5.6.3.

5.6.3. Product
:
.
:
1. Number of inputs .
.
() / ().
48

2. Multiplication .
( ):
Element-wise .
Matrix .

. 5.6.3. Sum

3. Saturate on integer overflow () .



.
Number of inputs ,
,
.

.
. 1
( ),
.
Product
. 5.6.4.

49

. 5.6.4. Product


. , ,

. Product
. 5.6.5.
, ,
.

. 5.6.5. Product

50

5.6.4.
MinMax
:
,
.
:
1. Function . :
min .
max .
2. Number of input ports .
.

, .
,
.
.
1,
.
MinMax . 5.6.6.

. 5.6.6. MinMax

5.6.5.
Rounding Function
:
.

51

:
Function ( ):
floor .
ceil .
round .
fix .
,
.
.
double single.
Rounding Function . 5.6.7.

. 5.6.7. Rounding Function

5.6.6. Logical Operation


:
.
:
1. Operator (
):
AND ( ).
OR ( ).

52

NAND -.
NOR -.
XOR ( 2).
NOT ().
2. Number of input ports .
1,
, 0, .
,
. ,
,
.
, ,

. ,
,
.

.
,
(boolean).
Logical Operation . 5.6.8.

5.6.7. Gombinatorical Logic


:
.
:
Truth table .
Combinatorical Logic
, .

.
.
:
,

number of inuts ,
number of rows .

53

. 5.6.8. Logical Operation


. () ,
. :
,

row index ,
m ( ),
u(1) ( ),
u(m) ( ).
, (AND)
,
:
.

(AND) :

54

5.6.1
2

()
0

. 5.6.9
Combinatorical Logic. Truth table
[0;0;0;1].

. 5.6.9. Combinatorical Logic

5.7. Signal&Systems -

5.7.1. () Mux
:
.
:
1. Number of Inputs .
2. Display option . :
bar .
signals
.
none
.
() .
,
.
, [2 3 1] ,
,

55

, . ,
Number of Inputs,
Simulink .
-1 ( ).
.
Number of Inputs
, : Vector1, Vector2, Scalar.
.
,
( ).
Mux . 5.7.1.

. 5.7.1. Mux

5.7.2. () Demux
:
.
:
1. Number of Outputs .
2. Bus Selection Mode () .
,
. ,
Number of
Outputs .
P ( Number of Outputs)
N,
.

56

P , N,
P-1 N/P,
,

P-1 . ,
, ,
ceil(8/3) = 3,
8 - (3+3) = 2.
Number of Outputs
, . ,
[2 3 1] ,
, - ,
. -1 (
).

. ,
, Number of Outputs
[1 -1 3], 6 (3+1) = 2.
Demux . 5.7.2.

. 5.7.2. Demux

Bus Selection Mode Demux


, .
57

Mux
Demux. Number of Outputs ,
, ,

. , ,
Number of Outputs, [2 1],
,
, .
Demux Bus Selection Mode
. 5.7.3.

. 5.7.3. Demux Bus Selection Mode

5.7.3.
Data Store Memory
:
.
:
1. Data store nm .
2. Initial value .
3. Interpret vector parameters as 1-D ()
.

58

Data Store Write ( )


Data Store Read ( ).
Initial value ,
. ,
[0 1; 2 3], 22.
Data Store Memory ,
,
. Data Store
Memory ,

.
double.
Data Store Memory
Data Store Write Data Store Read . 5.7.4.

5.7.13.
Data Store Write
:
.
:
1. Data store nm .
2. Sample time .

.
Data Store Write,
. ,
,
.
Data Store Write Data
Store Memory Data Store Read . 5.7.4.

5.7.14.
Data Store Read
:
.
:
1. Data store nm .
2. Sample time .
59

.
Data Store Read,
.
Data Store Read Data
Store Memory Data Store Write . 5.7.4.
,
. ,

.
.

. 5.7.4. Data Store Memory, Data Store Write Data Store


Read.

5.8. Subsystem .
Simulink-,
.
:
1. ,
(
).
60

2. ,
.
3. .
4. .
5. .
6. - m-,
(
).

, (
, , ..).
, ,
.
.
(
) ( Inport
Sources) ( Outport Sinks) .

,
.
Inport Outport
(In Out) ,
.
(Subsystem)
(Atomic Subsystem).
.
, Simulink
.
,
,
, .
() Simulink
,
.

.
.
.
61

() ,
.
.
.
, ,
.

:
1. Subsystem .
2.
Create Subsystem Edit .
,
.
. , ,
, , ,

.
Undo.

. 5.9.2 ,

62

5.9.
5.9.1.

, . .
, , . .
:
1.
.
2. .
3. -.
4. .
5. .

:
1. ,
.
().
2. , (
,
).
3. .
4. () .
Mask Editor
( ).
Mask Subsystem
Edit. . Mask
Editor (. 5.9.1),
:
Icon (),
Initialization (),
Documentation ().
,

.
Mask Type,
.
:
1. OK .
2. Cancel .

63

3. Unmask .
, Edit Mask
Edit.
4. Help .
5. Apply .

Edit Mask Edit (
).
, ,
,
. ( )
Look under mask Edit
.

. 5.9.1 Mask Editor

5.9.2.
Initialization
() .
:
1. Add ().
64

2. Prompt ().
,
, Gain, Constant value . .
3. Variable ().
, ,
(
,
). ,
Initialization, Mask Workspace
,
.
4. Control
Type:
Edit .
Checkbox .
Popup . Popup Strings
( ) ,
. , alpha|beta|gamma
: alpha,beta gamma.
5. Assiggment:
Evaluate . ,
.
MATLAB. Evaluate
,

. , ,
alpha|beta|gamma
, alpha,
beta, gamma.
Checkbox 1 (
) 0 ( ).
Literal . ,
.
6. Initialization commands.

MATLAB m-.
,
.
65

,
,
.
:
.
.
Edit/Update diagram.
(
).
,
.

. . 5.9.2.

. 5.9.2 .

:
1.
,
.
2. (,
) .

66

, .
5.9.3.

. 5.10.3

, ,
5.9.1.
5.9.1.
N

Prompt

Variable

Internal
source of
frequency
signal
Frequency
(Hz)

Assiggment

Internal_freq

Control
Type
Checkbox

Evaluate

:
.

Freq

Edit

Evaluate

Wave form

Wave_form

Popup

Evaluate

Internal
source of
magnitude
signal
Magnitude

Internal_magn

Checkbox

Evaluate


:
,

:
.

Magn

Edit

Evaluate

Initialization,
, . 5.9.4.

67

. 5.9.4

( )
Selector1 (. . 5.9.2).
Elements Selector1 [(Internal_freq+1)].
, Internal source of frequency signal
, Internal_freq 1
,
, (. .
).
Internal_magn
.

Selector. ,
Mux,
Wave_form, Selector
. Elements
Selector [Wave_form]. , , ,
Wave form Sine,
Wave_form , , ,
, . . .

68

6.


6.1.



.
Simulink
MATLAB.

, .

:
.

:
1.

.
, .

. :
,
. :
, .

2.

, .
.
.
:

. :
, .

3.

, .
,
.
. .
:

69

, . :
.
4.

.
.
, , .
.
:
, ,
. :
, .

5.

.
.
. ,
.

. :
, .
: .

6.

.
:
. ,
.
: ,
,
. :
, .

7.

WEB-.
WEB-.
.
.
.
: ,
. :
, .

8.

-. -,
.
-.
.
: ,
. :
, .
70

9.

.
, .
.
: ,
, .
: ,
.

10. 1: .
.
, ,
.

. :
, .
: , .

6.2.


:
.
,
.


.
.
,
. ,
(
).
- .

.
. ,
-

.
- .
71

.
.

, , ,
, .
,
-
.
.


-.
- .
.

.

.
. ,
, ,

.

72

Anda mungkin juga menyukai

  • Drayvery Na Vse Sluchai Zhizni
    Drayvery Na Vse Sluchai Zhizni
    Dokumen7 halaman
    Drayvery Na Vse Sluchai Zhizni
    Roman Varvarici
    Belum ada peringkat
  • Berger Step7 Lad&Fbd Rus
    Berger Step7 Lad&Fbd Rus
    Dokumen605 halaman
    Berger Step7 Lad&Fbd Rus
    mrinal570
    Belum ada peringkat
  • Genebre Catalog
    Genebre Catalog
    Dokumen122 halaman
    Genebre Catalog
    Roman Varvarici
    Belum ada peringkat
  • Rashod
    Rashod
    Dokumen400 halaman
    Rashod
    Roman Varvarici
    Belum ada peringkat
  • Genebre 01.08.2012
    Genebre 01.08.2012
    Dokumen24 halaman
    Genebre 01.08.2012
    Roman Varvarici
    Belum ada peringkat
  • Im PC Re
    Im PC Re
    Dokumen52 halaman
    Im PC Re
    Roman Varvarici
    Belum ada peringkat
  • Zkod A5
    Zkod A5
    Dokumen8 halaman
    Zkod A5
    Roman Varvarici
    Belum ada peringkat
  • 2013 Produal Ooo Ru 010313
    2013 Produal Ooo Ru 010313
    Dokumen16 halaman
    2013 Produal Ooo Ru 010313
    Roman Varvarici
    Belum ada peringkat
  • FDROM
    FDROM
    Dokumen15 halaman
    FDROM
    Roman Varvarici
    Belum ada peringkat
  • FMD
    FMD
    Dokumen6 halaman
    FMD
    Roman Varvarici
    Belum ada peringkat
  • Chenar
    Chenar
    Dokumen25 halaman
    Chenar
    Roman Varvarici
    Belum ada peringkat
  • FMD
    FMD
    Dokumen6 halaman
    FMD
    Roman Varvarici
    Belum ada peringkat
  • FMD
    FMD
    Dokumen6 halaman
    FMD
    Roman Varvarici
    Belum ada peringkat
  • Lista Comenzilor La Microproc
    Lista Comenzilor La Microproc
    Dokumen3 halaman
    Lista Comenzilor La Microproc
    Roman Varvarici
    Belum ada peringkat