.


:




:

































 

 

 

 


Nntool

1. ¢

2.

3. NNTOOL ¢

4. ¢ , , .

1. MatLab

1. .

2. .

1. - .

2. ϳ , ¢ ( , ).

3. , , .

4. .20 , .

1. .

2. , .

 

 

1. () () , () . () òm(x)/x, òx R, m(x) [0,1]- x R .

2. . - R. *f (+, -, ´, /) :

*f = òmin(m(x), mB())/(x *f )

: < 2> +f < 6>

0/0 1/0.5 2/1 3/0.5 4/0    
             
4/0 5/0.0.25 7/0.25 8/0.25 9/0.25   4/0.25
5/0 6/0.5 7/0.5 8/0.5 9/0   5/0.5
6/0 7/0.5 8/1 9/0.5 10/0   6/1
7/0 8/0.5 9/0.5 10/0.5 11/0   7/0.5
8/0 9/0 10/0 11/0 12/0   8/0

 

= {6/0, 7/0.5, 8/1, 9/0.5, 10/0}. .

 

 

. ,

MatLab trimf.m

- TRIMF(X, PARAMS), PARAMS = [A B C] A <= B <= C.

2 + 6, MatLab

MatLab, ,

function out = fuzarith(x, A, B, operator)

%FUZARITH Fuzzy arithmetics.

% C = FUZARITH(X, A, B, OPERATOR) returns a fuzzy set C as the result

% of applying OPERATOR on fuzzy sets A and B of universe X. A, B, and X

% should be vectors of the same dimension. OPERATOR should be one of the

% following strings: 'sum', 'sub', 'prod', and 'div'. The returned fuzzy

% set C is a column vector with the same length as A and B. Note that

% This function uses interval arithmetics and it assumes

% 1. A and B are convex fuzzy sets;

% 2. Membership grades of A and B outside of X are zero.

%

% Fuzzy addition could generates "divide by zero" message, but it will

% not affect the correctness of this function. (However, this may cause

% problems on machines without IEEE arithmetic, such as VAX and Cray.)

%

% For example:

x = (0:0.2:14);

A = trimf(x, [0 2 4 ]);

B = trimf(x, [4 6 8]);

C1 = fuzarith(x, A, B, 'sum');

Subplot(2,2,1);

Plot(x, A, x, B, x, C1);

title('fuzzy addition A+B');

Grid on

C2 = fuzarith(x, B, A, 'sub');

Subplot(2,2,2);

Plot(x, A, x, B, x, C2);

title('fuzzy subtraction A-B');

Grid on

C3 = fuzarith(x, A, B, 'prod');

Subplot(2,2,3);

Plot(x, A, x, B, x, C3);

title('fuzzy multiplication A*B');

Grid on

C4 = fuzarith(x, B, A, 'div');

Subplot(2,2,4);

Plot(x, A,x, B, x, C4);

title('fuzzy division A/B');

Grid on

%Roger Jang, 6-23-95

% Copyright (c) 1994-98 by The MathWorks, Inc.

% $Revision: 1.4 $

%

x = x(:); A = A(:); B = B(:);

orig_x = x;

% augment x, A, and B for easy interpolation

A = [0; A; 0];

B = [0; B; 0];

x = [min(x)-(max(x)-min(x))/100; x; max(x)+(max(x)-min(x))/100];

tmp = find(diff(A)>0);

index1A = min(tmp):max(tmp)+1; % index for left shoulder

tmp = find(diff(A)<0);

index2A = min(tmp):max(tmp)+1; % index for right shoulder

tmp = find(diff(B)>0);

index1B = min(tmp):max(tmp)+1; % index for left shoulder

tmp = find(diff(B)<0);

index2B = min(tmp):max(tmp)+1; % index for right shoulder

height = linspace(0, 1, 101)';

index1 = find(height > max(A(index1A)));

index2 = find(height > max(A(index2A)));

index3 = find(height > max(B(index1B)));

index4 = find(height > max(B(index2B)));

height([index1; index2; index3; index4]) = [];

leftA = interp1(A(index1A), x(index1A), height, 'linear');

rightA = interp1(A(index2A), x(index2A), height, 'linear');

leftB = interp1(B(index1B), x(index1B), height, 'linear');

rightB = interp1(B(index2B), x(index2B), height, 'linear');

intervalA = [leftA rightA];

intervalB = [leftB rightB];

if strcmp(operator, 'sum'),

% interval mathematics for summation A+B

intervalC = [leftA+leftB rightA+rightB];

1 = [intervalC(:, 1); flipud(intervalC(:, 2))];

C = [height; flipud(height)];

elseif strcmp(operator, 'sub'),

% interval mathematics for subtraction A-B

intervalC = [leftA-rightB rightA-leftB];

1 = [intervalC(:, 1); flipud(intervalC(:, 2))];

C = [height; flipud(height)];

elseif strcmp(operator, 'prod'),

% interval mathematics for product A*B

tmp = [leftA.*leftB leftA.*rightB rightA.*leftB rightA.*rightB];

intervalC = [min(tmp')' max(tmp')'];

1 = [intervalC(:, 1); flipud(intervalC(:, 2))];

C = [height; flipud(height)];

elseif strcmp(operator, 'div'),

% interval mathematics for division A/B

index = (prod(intervalB')>0)'; % contains 0 or not

tmp1 = leftB.*index;

tmp = [leftA./leftB leftA./tmp1 leftA./rightB...

rightA./leftB rightA./tmp1 rightA./rightB];

intervalC = [min(tmp')' max(tmp')'];

1 = [intervalC(:, 1); flipud(intervalC(:, 2))];

C = [height; flipud(height)];

% get rid of inf or -inf due to division

index = find(~finite(1));

1 (index) = [];

C(index) = [];

Else

error('Unknown fuzzy arithmetic operator!');

End

% Make sure that 1 is monotonically increasing

index = find(diff(1) == 0);

1 (index) = [];

C(index) = [];

% Take care of "out-of-bound interpolation"

index1 = find(orig_x < min(1));

index2 = find(orig_x > max(1));

% tmp_x is legal input for interp1

tmp_x = orig_x;

tmp_x([index1; index2]) = [];

% Do interpolation

out = interp1(1, C, tmp_x, 'linear');

% Final output

out = [zeros(size(index1)); out; zeros(size(index2))];

 

 

. Fuzarith.m:

()

Fuzzy Logic Toolbox 11 , :

-;

;

;

.

mf. - :

Namemf(x, params),

namemf ; x , ; params .

(trimf) (trapmf) - - . , -. -: ; .

(gaussmf) (gaussmf) . gaussmf . (gbellmf) . ֳ - , .

sigmf, dsigmf, psigmf -. ֳ , - + (-) 1. .

zmf, pimf smf, sigmf, dsigmf, psigmf, .

. 6.1. . 6.1 , - mfdemo. , - .

Fuzzy Logic Toolbox . m-, , . . m-, :

function mu=bellmf(x, params)
%bellmf bell membership function;
%x input vector;
%params(1) concentration coefficient (>0);
%params(2) coordinate of maximuma.
a=params(1);
b=params(2);
mu=1./(1+ ((x-b)/a).^2);

. 6.1.

6.1.

   
dsigmf -
gauss2mf   c1<c2, ; c1>c2, .

 

gaussmf
gbellmf
pimf - smf zmf
psigmf
sigmf
smf s-
trapmf
trimf
zmf z-

 

 
[a1 c1 a2 c2]  
[c b]  
[a b c]  
[a b c d] [a d] ; [b c] ;    
[a1 c1 a2 c2]  
[a c]  
[a, b]  
[a, b, c, d]  
[a, b, c]  
[a, b]  


 

Fuzzy Logic Toolbox MatLab, , : ;

a
 
  10- gaussmf 7- trapmf 4- trimf centroid
  11- trimf 10- gaussmf 7- trapmf bisector
  10- 10- gaussmf 10- trapmf centroid
  10- gaussmf 10- gaussmf 10- gaussmf bisector
  10- trapmf 10- trapmf 10- trapmf centroid
  10- 15- gaussmf 11- trimf bisector
  10- trapmf 10- trimf 10- trimf centroid
  10- 10- gaussmf 10- trapmf centroid
  10- gaussmf 10- gaussmf 10- gaussmf bisector

 

1. .

2. .

1. - .

2. ϳ , ¢ ( , ).

3. , , .

4. .20 , .

1. .

2. , .

 

Fuzzy Logic Toolbox , (, ) , . , , . :

 

% y= 1 ^2*sin(x2-1)

%

% x1[-7,3] x2[-4.4,1.7].
n=15;
1 =-7:10/(n-1):3;
x2=-4.4:6.1/(n-1):1.7;
y=zeros(n,n);
for j=1:n
y(j,:)= 1. ^2*sin(x2(j)-1);
end
surf(1,x2,y)
xlabel(' 1 ')
ylabel('x2')
zlabel('')
title('Target');

 

, . 3.1. , , .

.3.1.

10. fis- - fuzzy - . ϳ , . 3.2.

 

 

.3.2. ³ FIS-Editor

20. : , Edit Add input.

30. . input1, 1 <Enter>.

40. ³ . input2, x2 <Enter>.

50. . . output1, y <Enter>.

60. ' . File Export To disk ' , , first.

70. . 1.

80. 1. -7 3 Range (. . 3.3) <Enter>.

90. 1. 3 . Edit Add MFs... ' . 3 . <Enter>.

100. 1. (. . 3.3). , , , Name <Enter>. , , , Name <Enter>. , , , Name <Enter>. , . 3.3.

.3.3. 1

110. x2. 5 . x2 x2. x2. -4.4 1.7 Range (. . 3.4) <Enter>. Edit Add MFs.... , ¢, gaussmf MF type 5 Number of MFs. ϳ <Enter>.

3.4. x2

120. 㳺 10 x2: , , , , . , . 3.4.

130. y. 5 . y y. y. -50 50 Range (. . 3.5) <Enter>. Edit Add MFs.... , ¢, 5 Number of MFs. ϳ <Enter>.

3.5. y

140. 10 y: , , , , . , . 3.5.

150. RuleEditor. Edit Edit rules....

160. , . 3.1 ' :

1. 1 =, y =;

2. 1 = 2 =, =;

3. 1 = 2 =, =;

4. 1 = 2 =, = ;

5. 1 = 2 =, = ;

6. 1 = 2 =, =;

7. 1 = 2 =, =;

8. 1 = 2 = , =;

9. 1 = 2 = , =.

Add rule. . 3.6 ' . , .

3.6. RuleEditor

170. . File Export To disk.

. 3.7 . View rules... View. Input , .

3.7. ³ RuleViewer

. 3.8 -, . View surface... View. . 3.1 . 3.8 , .

.

3.8. - SurfaceViwer

 

 

() :

- ;

-

 

 

   
  y=F (x 1, x 2) = sin(x 1 + x 2) x 1 x 1, x 2 [0, 2pi]  
  y= F (x 1, x 2)=exp( x 1)+ sin(x 2/2) x 1, x 2 [0, 2pi]  
  y=F (x 1, x 2, x 3) = sin(x 1 + x 2 + x 3) x 1, x 2, x 3 [0, 2pi/3]  
  y=F (x 1, x 2, x 3) = cos(x 1 + x 2 + x 3) x 1, x 2, x 3 [0, 2pi/3]  
  y=F (x 1, x 2, x 3) = sin((x 1+ x 2 + x 3)/2) x 1, x 2, x 3 [0, 2pi/3]  
  y=F (x 1, x 2, x 3) = cos((x 1+ x 2 + x 3)/2) x 1, x 2, x 3 [0, 2pi/3]  
  y=F (x 1, x 2, x 3) = exp( x 1) + exp( x 2) + exp(x 3/2) x 1, x 2, x 3 [0, 2pi/3]  
  y=F (x 1, x 2, x 3) = sin(x 1 + x 2 + x 3) x 1, x 2, x 3 [0, 2pi/3]  

 

Nntool

( )

 

1. ¢ - Nntool.

2. .

1. - .

2. ϳ , ¢ ( ).

3. , , ¢ , .

4. .20 , .

1. .

2. , .

 

(NN - Neural Networks) . , ,

- , . 㳿 MATLAB. ' - MATLAB 6.0, GUI (Graphical User Interface - ) - NNTool.

㳿 : , , , , , , . : , , , , , , , (, , ) ..

NNTool , , , ' .

ϳ , . - , . , , , . .

NNTool . - , NNTool:

;

;

;

;

.

.

NNTool

NNTool, MATLAB:

>> nntool

' NNTool, "³ " (Network/Data Manager) (. 1).

. 1. NNTool

" " (Networks and Data) :

(Help)- ;

(New Data...)- , ;

(New Network...)- ;

(Import...)- MATLAB NNTool;

(Export...)- NNTool MATLAB;

(View)- ;

(Delete)- '.

"ҳ " (Networks only) . ' - , . NNTool ', View, Delete, Initialize, Simulate, Train Adapt ( . 1 ) ', . ' , ' , .

NNTool .

1.

, "".

, . , , (). ( ) , .

. "", P1 2 - , - (. 1).

. 1. ""

P1 P2 A
     
     
     
     

, -, , New Data. , ', , . 2, "" (Create).

. 2.   . 3.  

 

ϳ ' data1 Inputs. (. 3).

ϳ Create Targets ' target1. "" (Value) - MATLAB . ,

bitand([0 0 1 1], [0 1 0 1]).

. New Network , . 4.

:

' (Network Name) - ' ' .

(Network Type)- , . , .

(Input ranges)- , . : - , , - . , , " " (Get from input), , ' .

ʳ (Number of neurons)- .

(Transfer function)- ( ) .

(Learning function)- , .

. 4. ³ " "     . 5.  

 

"" (View) (. 5)., , 񳺿 䳿 . . 5 , . ʳ , - . , - .

, . , "" (Close), , "" (Create) .

"" (Networks) NNTool ' ' ' network1.

- , . , , ( - "/"). , . MATLAB , . , LEARNP , (. 4).

NNTool. "ҳ " (Networks only). , , , .

³ ' network1, Train. "Train" , , , (. 6). - . " " (Training info) "" (Inputs) "" (Targets). "" (Outputs) "" (Errors) NNTool . , , .

. 6. ³ , "" (Train)   . 7.    

 

, . , , . , ' .

" " (Training parameters) (. 7) :

ʳ (epochs)- ( ), .

.

(goal)- , .

(show)- , .

(time)- , , .

, ( ) , , . . , Inf, ( Infinite - ).

"' " (Optional Info) . 8.

.8. '   . 9.  

 

(Train). , " " (Train Network). ϳ , , (Training Parameters), ' , - . , . 9. " " (Stop Training) . , , (goal = 0).

, , , .

, . . "" (Simulate) , , "" (Inputs) . , data1. " " (Supply Targets). . " " (Simulate Network) , ' "" (Outputs). NNTool , network1, "" (View). - .

, , . , "-" (Initialize) . , , " " (Initialize Weights).

"' " (Optional Info) (. 8). , , : .

. , . . , , . .

. : (Training Data) (Validation Data). . . , , , , , . , , . (Early stopping).

, , . , .

, (, , , ). - (Test Data), . ϳ , . , , . , .

(. 8) (, , ). .

. ' , NNTool , : Train "" (Adapt). Adapt (Adaption Info), , Training Info (Adaption Parameters). "" (passes). , , , .

"Train" "Adapt" MATLAB - train adapt, . HELP-.

-

. - , . .

, " ".

2.

, " ".

(. 2).

2. " "

P1 P2 A
     
     
     
     

" " ? , (. 10), : P1 P2, A , , , A - .

- , . . 10 , , . , , , , .

- , , , .

. 10. " "   . 11. " "  

 

, , (. 11). MSE (Mean Square Error - ). , " " .

, Initialize Weights Initialize, , data1, - , . , . , . 12.

, , , , . , , .

" " . .

 

 

. 12. " "   . 13.  

, , . , . .

3.

x 1?N, N - .

, "" (Value) :

sin(5*pi*[1:100]/100+sin(7*pi*[1:100]/100)).

5p/N, 7 N (. 15).

(1, 2, 3,..., 100), :

1:100.

. 14.   . 15. - , -  

 

(Feed-Forward Back Propagation) (TANSIG) (PURELIN) . , - (Levenberg-Mar-quardt), TRAINLM. - MSE. , . 13.

. , , (. 14).

. 15 . . 14 15 , 100 . , .

. .

4.

. ֳ - . , , , , 䳿 NNTool.

, , , (. 16).

. 16.   . 17.  

 

( ) , MATLAB. . 17 . , (. 18).

. 18.     . 19. ³ MAT-  

, , . . , . .

Feed-forward backprop ' ' . - -. 10-30.

, . .

, ,



<== | ==>
|
:


: 2016-10-06; !; : 625 |


:

:

, .
==> ...

1385 - | 1281 -


© 2015-2024 lektsii.org - -

: 0.292 .