Искусственные нейронные сети Лабораторный практикум

Embed Size (px)

Text of Искусственные нейронные сети Лабораторный практикум

  • . . , . . , . .

    2004

  • 2

    681.3 34

    : -

    ,

    . . .

    . . 34 , . . []: . -

    / . . , . . , . . . : - . . -, 2004. 136 .: 8 ., . 10 .

    , , - MATLAB 6 - Neural Networks Toolbox (NNT).

    - 220400 220100 -, .

    681.3

    , 2004 . ., . ., . ., 2004

  • 3

    -

    , (1011) , - . 1015.

    - , . (-) -. - : - ; ; ; ; -, . . , , -. Neural Networks Toolbox (NNT) MATLAB 6 Math Works.

    NNT - , -

  • 4

    . , , - . 15 . - - , , , , , , -, . - Real Time Workshop, MATLAB 6.

    , , NNT MATLAB 6 , - . - MATLAB - . - - , , . - , - NNT.

  • 5

    1

    MATLAB : - -

    MATLAB, - , , , , , -, -- .

    MATLAB -, , , , , - ( Simulink) . - , .

    MATLAB - . . - -. , , *.m -, -. - - , - . - .

  • 6

    MATLAB : -

    ( ) -.

    - . .

    , . MATLAB .

    MATLAB m, .

    - , -. MATLAB -: , ; -; ; .

    MATLAB -:

    1) : double, numeric, char, cell, array; 2) : 25, pi, eps, Hello, ans, m, n; 3) , : +,-,*; 4) : help, clear, plot, sin, cos; 5) : func, map, draw, paint, neuron; 6) : if, for, while, switch, try, catch, end; 7) : realmin, realmax, Inf, Nan; 8) : NNT, Simulink.

  • 7

    M- M- MATLAB : -, ; -, . - Script- -

    . , . . , - . - - MATLAB .

    - : % () % ( ) , -

    .

    lookfor help _. help _, .

    - - , , - . -- -, , - .

    - : function var=f_name (___ -

    ) % () % (-

    )

  • 8

    , - .

    var= var= , -

    , . - , - :

    Function[var1,var2,...]=f_name(___

    ) % () % (-

    ) , -

    . var1= var2= ... var, var1, var2, ...

    -.

    ,

    , MATLAB -, . - :

    1. : input (); 2. : if ... elsif ... else... end; 3. for...end: for _ _ end;

  • 9

    4. while...end: while _ _ end;

    5. : switch Exp case B1 case b2 otherwise end;

    6. try...catch...end: try _try catch _catch end;

    7. : pause, pause (...), pause on, pause off.

    input disp. input : = input() ,

    -. Enter, - .

    disp :

    disp ( )

    if -:

    if __If elseif __Elsif else __Else end

  • 10

    for...end - . :

    for var=, _ end

    s:d:e, s - var, d - e , - . d 1.

    while...end , -

    : while _ end -

    break continue. ( ) -

    switch: switch switch_ case case_ _ case

    {case_1,case_2,case_3,...} _ ... otherwise, _ end

  • 11

    Case_ , , , . case , strcmp(, ) .

    try...catch...end - :

    try _ catch _ end . -

    catch , - , lasterr . catch .

    , , , , , . .

    pause. - :

    1) pause ; 2) pause(N) N ; 3) pause on ; 4) pause off .

  • 12

    1. -

    [xmin, xmax].

    1. m- : %Plot with color red % % [xmin, xmax] x=xmin:0.1:xmax; plot(x,sin(x),'r') grid on

    2. pcr.m. 3. MATLAB : >> help pcr Ha , -

    :

    Plot with color red [xmin, xmax]

    >>

    4. : >> pcr ??? Undefined function or variable 'xmin'.

    Error in ==> C:\MATLAB6p1\work\pcr.m On line 4 ==> x=xmin:0.1:xmax;

  • 13

    , - , . - -:

    5. xmin xmax >> xmin=-10; >> xmax = 10; 6. >> pcr 2. -

    , : 1. m- : %Plot with color red % % [xmin, xmax] function x=fun(xmin,xmax) x=xmin:0.1:xmax; plot(x,sin(x),'r') grid on 2. fun.m. 3. MATLAB : fun(-10,10); , xmin xmax -

    .

  • 14

    3. - , :

    1. m- : %Plot with color red % % [xmin, xmax] disp(' xmin xmax '); xmin=input('xmin = '); xmax=input('xmax = '); x=xmin:0.1:xmax; plot(x,sin(x),'r') grid on 2. pcrdialog.m. 3. MATLAB : >> pcrdialog , xmin xmax

    , .

  • 15

    2 , , MATLAB

    : , -, MATLAB, - .

    ,

    MATLAB : (), () - .

    MATLAB - . - , :

    1. : ones, zeros, rand; 2. : cat (dim, , ), cat (dim, A1, A2, A3, ...); 3. : fliplr, flipud, perms; 4. : prod, cumprod,

    sum; 5. : rot 90(A), rot 90(A,k); 6. : tril (x), tril (x,k), triu ; 7. : compan; 8. : cand, det, rank, norm; 9. : +, -, *, .*, /, ./, ^, .^ . ,

    MATLAB 11, - . .

  • 16

    , - . , - .

    ,

    . .

    MATLAB - :

    struct

    fieldnames

    getfield

    setfield

    rmfield

    isfield ,

    isstruct ,

    , -

    - .

    , -

    ; : , , .

    : ) ;

  • 17

    ) struct.

    11, . - MATLAB -.

    struct : str_array=struct(','','','

    ',...). ,

    . - . - , (.) , - .

    , , - . fieldnames -, setfield getfield.

    getfield - :

    f = getfield(array, {array_index}, 'field', {field_index})

    array_index field_index - ; 11. getfield

    f = array(array_index).field(field_index);

    setfield -

    , :

  • 18

    f = setfield(array, {array_index}, 'field', {field_index}, value)

    . .

    . - - , , .

    MATLAB ,

    , , . - :

    cell

    celldisp

    cellplot

    num2cell

    deal

    cell2struct

    struct2cell

    iscell ,

    , - .

    , , -

    ,

  • 19

    . - .

    : ) ; ) cell,

    , . ,

    . MATLAB . .

    , . - { }.

    ,

    , -.

    , - :

    ) -;

    ) .

    ( -)

    - , - . -

  • 20

    , . - . , , .

    ( -)

    , . - , .

    , -

    , . , :

    A(j : k ) = [ ] ,

    . reshape

    , ; reshape , .

    : ) ; ) ; ) ; ) .

  • 21

    - , MATLAB - .

    -

    . , -. .

    - MATLAB, -, - . -, , - MATLAB, -, , , . - - .

    MATLAB . , A = zeros(10, 10) 1010, double. - s = 'Hello world' char.

    . . - .

    -,

    , @.

    -, -

    . - @.

  • 22

    , (-) .

    isa class. , .

    isa(a, 'class_name') , a .

    class - .

    class(a) , a.

    .

    b = class_name(a), a , class_name. MATLAB class_name - a. - . class_name, MATLAB - , .

    double char. double - MATLAB, - . char .

    MATLAB , - . , , , MATLAB , . . :

    1. , , , . , .

  • 23

    2. , , , , . .

    3. , :

    ) , -;

    ) , - ;

    ) , - ;

    ) . . -

    . , , , , - . , , . . , private, @class_name.

    MATLAB, . - . - - .

    . - MATLAB . - - - .

    . -, . - , MATLAB -

  • 24

    , .

    1. ,

    , . 1. -

    : >> A(1,1)={[1 4 3; 0 5 8; 7 2 9]}; >> A(1,2)={'Anne Smith'}; >> A(2,1)={3+7i}; >> A(2,2)={-pi:pi/10:pi}; >> A A = [3x3 double] 'Anne Smith' [3.0000+ 7.0000i] [1x21 double] 2. -

    : >> A{1, 1} = [1 4 3; 0 5 8; 7 2 9]; >> A{1, 2} = 'Anne Smith'; >> A{2, 1} = 3+7i; >> A{2, 2} = -pi:pi/10:pi A = [3x3 double] 'Anne Smith' [3.0000+ 7.0000i] [1x21 double] 3.

    celldisp: >> celldisp(A) A{1,1} =

  • 25

    1 4 3 0 5 8 7 2 9 A{2,1} = 3.0000 + 7.0000i A{1,2} = Anne Smith A{2,2} = Columns 1 through 9 -3.1416 -2.8274 -2.5133 -2.1991 -1.8850 -1.5708 -1.2566