[applied optimization] design considerations of time in fuzzy systems volume 35 || matlab simulation...

37
Chapter 12 MATLAB SIMULATION OF FUZZY CIRCUITS 1. INTRODUCTION In previous chapters we found out how M athematica, an environment for doing mathematics by computers [40]' can help us with work in the field of fuzzy logic. We leaned on the basic environment of Mathemat- ica, but we have also shown the access to the tool FUzzy Logic Pack that is incorporated into the program environment. In addition to Mathe- matica, the enlarged MATLAB, a language of technical computing of The Math Works Inc. [57] is in wide-spread use. In the past few years, the applicability of this tool in the field of fuzzy logic has been ex- tended. Fuzzy Logic TOOLBOX [58] was added that we are going to apply for observation and display of fuzzy memorizing as treated in this book. There is a considerable difference between Fuzzy Logic Pack and Fuzzy Logic TOOLBOX, deriving from the fact that Mathematica is a common mathematical and display environment, while MATLAB is a matrix-wise oriented environment (MAT in name MATLAB is a abbre- viation for matrix and not for mathematics). The latter places more accent on simulation, numerical calculation and display of systems. Fuzzy Logic Pack is intended mainly for the creation of fuzzy sets and fuzzy relations. It is based on rich fuzzy algebra, fuzzy arithmetic, visualization, aggregation and so on. However, the package is more useful in fuzzy set theory than in the complex design of fuzzy systems. It can define inputs, outputs and fuzzy rules, which is sufficient to set a model, but it does not contain any adequate editing function to set and modify the complete FID-system nor satisfactory direct possibilities of simulation of fuzzy systems. 351 J. Virant, Design Considerations of Time in Fuzzy Systems © Springer Science+Business Media Dordrecht 2000

Upload: jernej

Post on 23-Dec-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 12

MATLAB SIMULATION OF FUZZY CIRCUITS

1. INTRODUCTION

In previous chapters we found out how M athematica, an environment for doing mathematics by computers [40]' can help us with work in the field of fuzzy logic. We leaned on the basic environment of Mathemat­ica, but we have also shown the access to the tool FUzzy Logic Pack that is incorporated into the program environment. In addition to Mathe­matica, the enlarged MATLAB, a language of technical computing of The Math Works Inc. [57] is in wide-spread use. In the past few years, the applicability of this tool in the field of fuzzy logic has been ex­tended. Fuzzy Logic TOOLBOX [58] was added that we are going to apply for observation and display of fuzzy memorizing as treated in this book. There is a considerable difference between Fuzzy Logic Pack and Fuzzy Logic TOOLBOX, deriving from the fact that Mathematica is a common mathematical and display environment, while MATLAB is a matrix-wise oriented environment (MAT in name MATLAB is a abbre­viation for matrix and not for mathematics). The latter places more accent on simulation, numerical calculation and display of systems.

Fuzzy Logic Pack is intended mainly for the creation of fuzzy sets and fuzzy relations. It is based on rich fuzzy algebra, fuzzy arithmetic, visualization, aggregation and so on. However, the package is more useful in fuzzy set theory than in the complex design of fuzzy systems. It can define inputs, outputs and fuzzy rules, which is sufficient to set a model, but it does not contain any adequate editing function to set and modify the complete FID-system nor satisfactory direct possibilities of simulation of fuzzy systems.

351

J. Virant, Design Considerations of Time in Fuzzy Systems© Springer Science+Business Media Dordrecht 2000

352 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

With respect to fuzzy systems, neural networks and a combination of both, Fuzzy Logic TOOLBOX is far more applicable than Fuzzy Logic Pack. We quote it in our book mainly for the reason as it links MAT­LAB and SIMULINK [59] together, so that in SIMULINK comprehen­sive simulations of fuzzy systems are possible. SIMULINK itself is an application supplement to MATLAB, designed for simulations of gen­eral control and regulation systems. Fuzzy Logic TOOLBOX enables SIMULINK to simulate fuzzy systems and to compare non-fuzzy and fuzzy solutions.

In previous chapters we have applied Mathematica only for displaying calculations and other fuzzy logic particularities. We did not occupy ourselves with environment itself. In this Chapter we are also not going to describe just the MATLAB environment, as this subject is covered by the literature quoted. Our aim is to apply the tool for simulation­wise presentation of calculations and other fuzzy logic particularities contained in our book.

2. BUILDING FUZZY MODELS In Fuzzy Logic TOOLBOX we have an instruction called fuzblock

which sets up fuzzy logic controller with one input and one output. We see it in Fig. 12.1. Of course, such a controller has more inputs and outputs which can be simply reached by multiplexors, Mux blocks, and demultiplexors, Demux blocks, at input and output of the controller in Fig. 12.1. In such a way, the fuzzy controller can be transferred into the domain of the tool SIMULINK, where we can add to the controller everything this tool contains and can do. There are many sets of simu­lation building blocks and elements. Among them we can find blocks of crisp logic, for example, combinatorial logic, flip-flops, switches, delays and neural networks, but there is nothing available for fuzzy logic.

input ~ resunof

facts ~ defuzzifica1ian

Fuzzy LogiC Controller

Figure 12.1 . Fuzzy controller, which is useed in tool SIMULINK.

What we need in the frame of fuzzy logic is installed in the fuzzy con­troller in Fig. 12.1 that we previously set up and edited by FIS-editor in Fuzzy Logic TOOLBOX. Here, the abbreviation FIS means fuzzy in-

MATLAB SIMULATIONS OF FUZZY CIRCUITS 353

jerence system. Fuzzy Logic TOOLBOX enables us to do a lot from the aspect of fuzzy logic and neural networks. However, it unfortunately does not pay any particular attention to fuzzy temporal characteris­tics which are the object of our observation in this book. This means that we have to compose a set of building blocks for designing fuzzy systems. This is not actually difficult, as the environment is oriented disk-wise, which means that for particular elements, building block or groups of them we have disk oriented libraries named XXX.M. When for a particular job or observation we need a certain block, it must be previously loaded into workspace. In the workspace we can have even more fuzzy controllers or other logically complete building blocks at the same time. If we do not load all the required variables, the simulation within SIMULINK will not start.

3. LIBRARY OF FUZZY BLOCKS In Fig. 12.2 is an example of 22 blocks forming the library TSNORM.M

which we can, like the others, reach by the tool SIMULINK. In Table 12.1 we find 7 blocks related to 2, 3, and 4 input operators Max and Min that are, together with negation Neg, indispensable combinatorial blocks of fuzzy inference machines. Today, fuzzy inference machines are designed using only combinatorial blocks. Into such machines we need to introduce fuzzy sequential circuits with the ability to change Fig. 7.2 into Fig. 7.3. Therefore memorizing devices are quoted in the second and third part of Table 12.1 where we find fuzzy memory cells and fuzzy registers.

In spite of the fact that we met F JK, FRS, FT and FD memory cells from the logical aspect in Chapter 9, it is useful to look at their simulation models and their derivatives in the context of SIMULINK.

In Fig. 12.3 is a basic FT memory cell where in_l is input T and out_l output Q. The next-state function for this cell is given in the first equation of Eqs. 9.26. In Fig. 12.4 we have an FSR memory cell where iD-l is input Sand i1L2 input R. From this figure it is evident that, regarding Eqs. 9.35, we have to deal only with the second of four possible expressions.

In Fig. 12.5 we see simulation scheme of an FJK memory cell where iD-l is input J and iD-2 is input K . At this cell a switching ele­ment Switch is necessary to switch either upper or lower fuzzy max-min scheme into feedback sling. The switch is a standard block we can use for simulations based on the tool SIMULINK. Why the switch is neces­sary we have found out in the context of Eq. 9.23. We have not applied Eq. 9.24 which is, as we know, also possible.

354 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

~H~1£B ,~ ~H~H~HB 2max 3max 4max Neg 2mm 3min 4mln 2maxmn

Ql~ el~ ~ Ql~ ~~ ~ FTeell FTCcell FTOcell FTUcell FTDCeell FDceIl FSRcell FRSceIl FJKceIl FJ~Mcell

:~~~~ FTDCshift FSRdelay FTDCreg Periods

I Figure 12.2. Library of fuzzy blocks TSNORM.M

~----------------.C)

N •• 2min

~----------------~I~

Figure 12.3. FT-memory cell from library TSNORM.M

In Fig. 12.6. there is a simulation scheme of a fuzzy D memory cell with input D at in1. This cell is, as we know, a simplified example of an FSR memory cell from Fig. 12.4. We have not carried out done the simplification through hardware; we simply kept the basic inputs Sand R, but at the known condition S = R = D .

FTD and FTU memory cells in the library TSNORM.MA are built from a basic FT memory cell by applying some novel techniques that can be very useful for adequate implementations in fuzzy inference. These

MATLAB SIMULATIONS OF FUZZY CIRCUITS 355

Table 12.1. Library TSNORM.M of 22 fuzzy blocks

Name of device

2max

3max

4max

Neg 2min 3min 4min 2maxmin

FTcell FTCcell F"I'Dcell FTUcell F"I'DCcell FOcell FSRcell FRScell FJKcell FJKLMcell

FTDCshift FSRdelay F"I'DCreg Periods

Description

2 input max 3 input max 4 input max complement 2 input min 3 input min 4 input min 2 input maxmin

basic fuzzy T memory cell fuzzy T memory cell with clear input fuzzy T memory cell, initial state 0 fuzzy T memory cell, initial state 1 fuzzy T memory cell with clear and initial state 0 fuzzy delay memory cell fuzzy RS memory cell (type 1) fuzzy RS memory cell (type 2) fuzzy JK memory cell fuzzy JKLM memory cell

4 fuzzy bit shift register with 4 FTDC memory cells 4 fuzzy bit delay register with 4 FSR cells 4 fuzzy bits working register clock system

techniques are described by Virant, Zimic and Mraz in [42]. The same authors described the behaviors of FTD and FTU memory cells, and their implementation in the fuzzy sequential circuits used in the domain of fuzzy inference machines [56J.

Because of the ineffectiveness of the basic FT memory cell after setting to state Q = 0.5 we make an input and output linear transformation, taking into account the design difficulties a) and b) mentioned in Section Fuzzy T Memory Cell in Chapter 9:

T= ~ ·T* G ' (12.1)

Q*=G·Q.

(T, Q) are variables of known FT and (T*, Q*) variables of the new FTD cell, where D means the initial state of the cell is Qi = O. In Fig. 12.7 we see gain G = 100, but the transformation works if G > 2. If 0:::; T* :::; 1 then 0:::; T < 0.5. At this condition the FT cell, which is a kernel of FTD cell, can never get into the critical (eqUilibrium) state Q = 0.5. The FTD

356 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

,..--------+IC) OUI_1

3m •• . ~ r----------,r--.cr:8 Unit Delay

N.g

I

Figure 12.4. Model of FSRcell from library TSNORM.M.

out. I

Figure 12.5. FJK memory cell from library TSNORM.M.

memory cell can have state 0 :::; Q* :::; 1, taking output transformation as shown in the second expression of Eqs. 12.1. In Fig. 12.7 there is iILl = T* and out_l = Q*. Normally the FTD cell has initial state Q = 0 and a monotonic increase of value T.

The FT(D) memory cell becomes an FT(D)C cell if it also includes a clearing command. Input iIL2 in Fig. 12.7 is clear input, C. If C = 1 the memory cell is active, but if C = 0 and T = 0 then DIQ = O. We

MATLAB SIMULATIONS OF FUZZY CIRCUITS 357

Neg FSRceIl

Figure 12.6. FD-memory cell from library TSNORM.M.

Gain1

Figure 12.1. FTD memory cell in library TSFORM.M.

can write the new value into the cell immediately after C becomes 1. In this case DIQ = min(C, T) = min(1, T) = T .

co~~~Q ~~+ () ~ out2

- Gai n Sum FTce11 -

Figure 12.B. FTU-memory cell from library TSNORM.M.

Fig. 12.8 shows the case of the complementary initial state of the cell, Q = 1 by monotonic falling input T. U in the name of the cell marks the upper initial states of variables. The FT(D)(C)U memory cell is applicable in the fuzzy inference domain by the input/output

358 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

transformations

T = 0.5 . (1 + T*) , Q*=Q. (12.2)

The nature of the output signal of the FTU memory cell is dynamic. If T falls (complement of T grows) the amplitude of the output oscillating signal falls also. This amplitude is stored if T again has to increase. With a very simple fuzzy gate circuit in the cell we change the dynamical signal to a stationary one [421 .

4. OUTLINES OF A SIMULATION Let us show how a fuzzy sequential circuit can be simulated. We take,

for example, an FD memory cell as a block to be simulated. Before sim­ulation we must, with the SIMULINK graphical editor, add input vari­ables using source blocks from the signal source library. We have only one input variable, delay D, for which we choose Repeating Sequence, which generates a cycle from the data table. Results from the observed object must be displayed and compared with other data and results. For this we need sink blocks from the signal sinks library. Mostly we take Auto-Scale Graphs or Scope which interprets the MATLAB figure win­dow. The number of input channels to compare different data behaviors is defined with multiplexer Mux before Auto-Scale Graph or Scope. All the building blocks and other blocks in SIMULINK have a window to set all required parameters. Simulation can start when all parameters are set. Parameters and start of simulation are in the main SIMULINK command line. The resulting diagrams shown with Auto-Scale Graph or Scope are generated during the course of simulation.

Figure 12.9. Evaluation of simulated fuzzy logic circuit.

In Fig. 12.9 we compare the input signal D and the next output signal DIQ. We set Repeating Sequence block to simulation-time vector

t = (0,25,30,40,60,100) .

MATLAB SIMULATIONS OF FUZZY CIRCUITS 359

fd

°O~~'~O~2~O~30~~40~~50~~60~~70--8~O--~~ Tin-e (Seconds)

Figure 12.10. Comparison of next state DIQ and input D of FD memory cell.

Simulation time unit is one second. but in real time this can be ns, min, hour, etc. In time t we have an input variable

D = (0,0,1,0.2,0.2,0.8,0).

So, at t = 60 s input D has value 0.8. The result of the simulation is shown in Fig. 12.10. We can see how the signal DIQ is delayed with respect to input D.

Fig. 12.9 shows the MATLAB graphical program fdm.mdl itself, which is executable direct from the graphics editor. Models xxx. mdl are normal files which are stored before or after simulation.

5. SIMULATION OF FUZZY MEMORY CELLS 5.1 FT Memory Cell

First let us look at the basic FT memory cell. We execute the simula­tion in the time interval 0 - 100 s. From the source library in SIMULINK we take the source block Repeating Sequence with typical time vector t = (0,20,30,40,50,60,100) and input vector T = (0,0,0,1,0,0,0). So input T represents fuzzy set A = (30,40,40, 50)p in time space T = {O, 1,2, ... , 100}. Set A represents the poorly-known date a. If /-LA enters the FT memory cell as input T we get the result shown in Fig. 12.11. The ouput of the cell follows the input signal only as far as Q(t) = 0.5. This state cannot be altered by any further change in value of input T. It means that the FT cell is not uniformly applicable over the interval [0,1]' since we cannot change the state 0.5. Regarding the output Q = 0.5 the cell behaves differently; in the interval [0,0.5] it behaves dif­ferently than in interval [0.5,1.0] if only the value of input increases or

360 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

fl<

· . 1 --- - -l-----i-----+-----:-----j------~- - ---:-----i----+---

· . · . . OB ----- ;---- -~------~- _ _ _ _ _____ _____ • _________ __ • __________ _

· . . · . . · . . · . . , ., ., ,

06 -- - .- ~---- --~-- ---t-- ---1- -- ---~--D1Q~- ·---1-----~-- _0_

, ... .. , ""'" , • I • , , • • •

0.' - ----l - ----r----~- --r--- -r---:---"'j---" !" -'-r--02 -----j-----+----+ ---->-l------~ - ----[- -- --j---- -:- ----

. . . . , .. .

Time (Seconds)

Figure 12_11_ Next output D1Q of basic FT memory cell, T = /-I-A.

decreases. This diversity is confirmed by Fig. 12.12 where we see the relations at T = J-L'A' where A = 1- A, and J-L'A = 1- J-LA. In the first part of the behavior of the output course, at T > 0.5 and time 0-35 s., we have dynamic mapping Q =::} Q and, in the second part, at times from 35 to 100 s, we have Q = 0.5.

ftc

O.B • i,A-'I·' 06 : ~.-t--j-].--,--:------f---.+ ... +---.

0.4 11,,~II,,"llallllll"~1 A,_; ___ .j __ ~_ ~~ _____ ~-----;-----j-----.;- T: : : : :

• , I • • , , , . . , ,

0.2 -- -l----(----r----r---l- ---- j-----°0~~10~ll20~~30--4LO--5~0~60~~70--~60--9~0~,00

Til'Te (SecondS)

Figure 12.12. Next output Dl Q of FT memory cell, T = J-tA.

How can we eliminate or better control the equilibrium state Q = 0.5 of an FT memory cell? We can make use, for example, of FTD and FTU memory cells we presented in Figs. 12.7 and 12.8, where we employed Eqs. 12.1 and 12.2. FTD enlarges the characteristic of the FT memory cell from the space [0,0.5] to [0,1]. Instead of Fig. 12.11, we get Fig.

MATLAB SIMULATIONS OF FUZZY CIRCUITS 361

12.13 in the case of FTD. We see that in such a case the FTD cell can be applied in the following sense: if a is a fuzzy date with fuzzy set A and T = /-LA , DIQ is equal to the term after a. From Fig. 12.13 we conclude that we come from fuzzy point A to the fuzzy interval variable [DIQ, +00] that we have met in previous chapters.

dfcel

, I I I

1 ••••• : ••••• ~ • ••••• ~ ••••• y.. ---':-"':"---';"'''''''':-''':''---1

: : : . . . !D'Q! 0.8 ..•.. L. ... J.. ... L.A.i.\ ... ~ ..... L ... ~ ..... i ..... j .....

: : : Ii : \: : : : :

0.6 ••••• j ...... : ..... .: ..... j ... < ...... : ...... ; ..... 1... .. L. .. j j ~ j \ : ! j j

0.4 ••••• i ..... 1. ... J ..... i ..... i\. ... .! ...... l ..... l ..... J .... . ! ! h! ! ! \! iii

0.2 ..... i·····j··A .. ~ ..... j ..... j .. .\.L ... L .... i .. ... J.. ... : :Ii: : : \: : : : , ..,',"

o,--~'_..u....~' _~' ~'~~~' _~' _~' --' o 10 20 30 40 50 60 70 80 90 100

Tirre (Seconds)

Figure 12.13. Output D1Q of FTD memory cell, T = /-tA.

For dynamic memorizing of incomplete information Fig. 12.14 is also interesting, as enabled by an FTU memory cell. Value Q = 0.5 at time 35 :::; t :::; 100 s in Fig. 12.14 is transformed into an oscillation with amplitude a = Tmin . In Fig. 12.14 this value is 0.6 at the input vector T = (1,1,0.6,1,1) and time vector t = (0,39, 40,41,100). After simulation time of 40 s, when in Fig. 12.14 the minimum input value 0.6 appears, we have continuous oscillation of the output with amplitude a = T min = 0.6, If we had chosen Tmin = 0.5, we would get Fig. 12.12, otherwise we get the value of amplitude shown in Fig. 12.14, where a = 2b - 1, o :::; b :::; 1. With one min() and one max() operator we also get a stationary picture of relations in Fig. 12.14 (see [42]) . However, the FTU memory cell represents a dynamic analog memory device that can store information of one fuzzy bit.

From a library of crisp memory cells, flip-flops, which is located in SIMULINK under the name Extras, we can choose an ordinary, crisp T memory cell, that is actually a JK memory cell with binary condition J = K = T. Let us put to it the same input signal as in Fig. 12.12 to the FTU memory cell. The result is shown in Fig. 12.15. The output DIQ oscillates between 0 and 1, with the exception when input T is very

362 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

10 20 30 40 50 60 70 80 90 100 Till"e (Seconds)

Figure 12.14. Output Dl Q of FTU memory cell if T min = 0.6.

close to value O. It is interesting to compare the characteristics of FT, FTD, FTU, and crisp T memory cells shown in Figs. 12.12 to 12.15.

ostc

• 1 • T :D Q: · ~ .

0 .8 · I'~' : 0.6 · I'~'

0.' · IJ· 0 .2 · lj·

0 ~. 0 10 20 30 '0 50 60 70 eo 90 100

Time (Seconds)

Figure 12.15. Response of crisp T memory cell considering input data in Fig. 12.12

In Chapter 9 we observed an FT memory cell in Mathematica envi­ronment. Among others we examined the cell from the aspect of how it realizes fuzzy implication with one stored variable, the value of this variable in the present time being Q. Let us pay attention to this impor­tant logic function in this Chapter when observing a simulation based on the MATLAB environment. On the basis of Table 9.3 and Eq. 9.31 we found that input has to be T = min( 1 - x, 1 - Q) if, wi thin time t + 1,

MATLAB SIMULATIONS OF FUZZY CIRCUITS 363

we want to have implication as the output of the cell. In the observed case DIQ = max(1 - x, Q).

Figure 12.16. Simulation scheme for KD-implication where one variable is memorized in FTD-memory cell.

In Fig. 12.16 we have simulation scheme of implication for the just mentioned calculation of input T and output DIQ. We form and set in­put T either by source Repeating Sequence or by source Sine Wave. In Fig. 12.16 the first example is presented; the graphics editor in SIMULINK allows us to shift quickly to the other source as well. The simulation gives the results shown in Figs. 12.17 and 12.18. In the first case the input vector is x = (1,0.9,1,1,0.75,1,1,0.7,1,1,0.05, 1,1) at time vector t = (0,1,2,19,20, 21 , 49,50,51 , 79,80,81,100).

tdirrpl

X: . . · . 0.0 .. ..• .... .." . .. .. .. . . .... . ..... .. .. .. .

. " , . " 0.6 •• • • -:-- - - - :-. _._-:- - - - _. --- •• ;" ._---;--- _._;-- .--~ ••• _.

,. ".

0.4 •• ••• j.~.,.~! ...... ~ ..... ·····j······1· .. ··j·····j .... · .... . · ", .

0.2 .......... ~ ...... ~ ........ .. : ...... ~ ..... ; ..... : ...... ... . ,. . , . · . .. · .

20 40 60 00 100 120 140 160 190 200 Tm~ (Seconds)

Figure 12.17. Implication behavior of output Dl Q for a given input signal.

364 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

The FTD memory cell gives us DIQ = max(l - x, Q) according to sequence of input impulses. Let us examine all minimum values of x and the respective values of DIQ:

t = 1 DIQ = max(l - 1,0) = 0 t = 2 DIQ = max(l -1,0.1) = 0.1

t = 20 DIQ = max(l - 0.75, 0.1) = 0.25 t = 21 DIQ = max(l - 1,0.25) = 0.25

t = 50 DIQ = max(l - 0.05,0.3) = 0.3 t = 51 DIQ = max(l - 1,0.3) = 0.3

t = 80 DIQ = max(l - 0.05,0.3) = 0.95 t = 81 DIQ = max(1 - 1,0.95) = 0.95

Fig. 12.17 shows a simulation for 2008. Variable x is a periodic function with period of 1008 so that we have two periods in the figure. In the first, output value increases with impulses and in the second we have constant output value Q = 0.95. Why? Implication DIQ = max(l-x, Q) behaves in the first period according to variable (1 - x) as Q < (1 - x) and in the second according to variable Q as Q > (1 - x). DIQ tells us by its value what was the minimum of variable x at the time of observation. In this case it is 1- DIQmax = 1 - 0.95 = 0.05.

tdirrpl

o.s ____ _ ~ ___ _

200 Tirre (Se conds)

Figure 12.18. Reaction ofFTD memory cell to the first drop of input signal x.

MATLAB SIMULATIONS OF FUZZY CIRCUITS 365

Let us look at the situation also at the source of input data Sine wave in Fig. 12.16. In Fig. 12.18 we have input x = 1 + sin(rt) at r = 0.1 rad/s. and we apply Saturation to interval [0,11. DIQ takes value 1 a little before 50 s. This value cannot be reduced by any input x, as max(x, 1) = 1.

We have a similar result to those in Figs. 12.17 and 12.18 in the case of basic FT memory cell in Fig. 12.11, but with reference to equilibrium point Q = 0.5. Consequently DIQ can after, e.g. 35s of simulation, not increase to value 1 - after this time it takes the constant value 0.5.

5.2 FRS Memory Cell In case of Fig. 12.13 we said that the FTD memory cell maps fuzzy

date a into fuzzy relation after a. If we observe FSR memory cell it can, in the case of fuzzy dates a and b, give us,the results after a and strictly before b. Fig. 12.19 for fuzzy inputs Sand R shows this. In the figure we can see membership of fuzzy date A = (25,30,30, 40)p as input S and membership of date B = (60,75,75, 85)p as input R. DIQ gives us interval Dl [A, B[ to which the linguistic expression matches.

1St

!O'Q! 1 .... - : •• _ .. ~- .... -ir-: --'-"--'--'---'-r'

0.2 ..... : ..... L ..

Tim! (Seconds)

Figure 12.19. Fuzzy time-interval Dl[S, R[, simulation with FSR memory cell.

5.3 FD Memory Cell FD is the simplest fuzzy memory cell. We have seen how to set it up by

simulation in the context of Fig. 12.6. Let us put on the input of such a memory cell membership of fuzzy set A = (25,30,40, 60)p. The reaction of the cell to the membership is shown in Fig. 12.20. At D = /-.lA(t), next output is given by DIQ = /-.lA(t). The difference between t and t + 1 represents one simulation step that is Is long. Such step is represented

366 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

by a clock in real systems which synchronizes fuzzy blocks in the fuzzy system. On the basis of FD memory cells we can design fuzzy delay lines and chains.

fd

. ..,, ' . . . . . , . , . 0.8 -_ • • •• : • • __ •• -1.. . . • . . . - ~ - - --I ' ••• -.-_·· · ·:· · · __ ·</ · ·· · ·· t ·····

i i :: (r·A)(f+ 1): i 0.6 __ • • •. : • •• • __ ; .••• : __ ____ ,._ __ _ • .0': ' .... -:---_.-:-._---:-._--

: : : A(tt+-l) : : : : , ., • I I I I . , • I I I ,. , . . ,'

0 .4 ••••• . :' . _-_.: . .. . • • • • • : •• _-_ .: ---t o •• •• ':--. - -.; . ----.;-- •••

, . . . , ,

0 .2 •• ••• • ~.- •• • ;.. . ' ... ~.ItL .j... ~ .. ... L ... L ... i .. ... I , , , I , I , , , , , , , . , . , . , , . ,. , . , " , . , . . ,. ,.

°O~~I~--2~~~3~~~·L-~·~~~7~~8~~~9~O~,OO Tim. (S econds)

Figure 12.20. Membership function of delayed fuzzy set A(t + 1).

6. SIMULATION OF FUZZY REGISTERS Most interpretations of fuzzy registers are brought out in the con­

text of the fuzzy JK memory cell. We can do the same since, in the library of fuzzy building blocks TSNORM.M, we have the well-known fuzzy flip-flop under the name of F JK memory cell. The FT memory cell is practically not mentioned in publications, and is present in inter­pretations of fuzzy registers even less. Reasons for this rejection of the FT cell are primarily:

• At T > 0.5 we fall into final state Q = 0.5 from which we cannot escape by any value of T.

• There is the problem of clearing the cell, especially if found in state Q=O.5.

In our book we do not want to avoid the FT, TFD and TFU mem­ory cells on the ground of the above reasons. On the contrary, we are interested in possible techniques that make cells TF, TFD and TFU applicable.

6.1 Clearing the FT Memory Cell First let us consider the possibility of clearing the basic FT memory

cell. In Fig. 12.21 we show the FT memory cell again, but with a certain

MATLAB SIMULATIONS OF FUZZY CIRCUITS 367

circuit in feedback of output Q. In the nonlinear library of SIMULINK we choose Switch and put it in the feedback of the cell where there is also 2maxi with inputs in-i, fuzzy trigger T, and in-2 fuzzy clear C. Clearing works if C > € where € is a small positive number, but normally we take the binary value C E {O, I}. When output of 2maxi is 0, Switch switches state Q to O. In this case Q = out_1, = O.

Figure 12.21. A possible clearing concept of FT memory cell.

Clearing can be done only at input in-i = 0 for any output value out_1. Operation of such clearing is shown in Fig. 12.22. The value of input in.2 = 1 enables the cell to function while value in-2 = 0 appearing at in-i = 0 enables clearing of the cell. In the figure we have this possibility at simulation time 100 s. The value of output Q = 0.5 changes to Q = O. After 100s, when C is again equal to 1, output Q starts to change with input T again until output again takes value 0.5 at 1258. We term the FT memory cell that has clearing input C, FTC memory cell. It is available in the library TSNORM.M under the name FTCcell in Fig. 12.2. We also add clearing C to the FTD and FTU producing FTDC and FTUC cells accordingly. The first is also in the library under the name FTDCcell.

6.2 Fuzzy Register FTDCreg Now that we know how to set cell by input T and clear cell by in­

put C we can build a register by means of building blocks in library TSNORM.M. In Fig. 12.23 we see such a register for four fuzzy bits, which means that we have memory capacity of four fuzzy bits. Each bit place in this memory can store any value from the interval [0,1]. This 4-fuzzy-bit register substitutes four computer words of, we can say, 16

368 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

Table 12.2. Clear and Write specification of FTDC cell

o 0 Clear fJ, 1 Write

crisp bits or more. So 4 fuzzy bits substitute at least 4 x 4 = 16 crisp bits in an ordinary computer. With 4 crisp bits we can divide the in­terval [0,1] into only 16 parts. From this comparison we see that fuzzy processing can be very effective if we use fuzzy hardware or respective fuzzy computer. At inputs 1, 2, 3, and 4, information (membership value) enters respectively into cells FTDCcell, TTDCce1l1, FTDCce1l2 and FTDCce1l3. At outputs 1, 2, 3, and 4 we have respective outputs Ql, Q2, Q3 and Q4. Complements regarding value 1 are also available at outputs 5, 6, 7, and 8 as Ql, Q2, Q3 and Q4. Besides inputs 1 to 4 we have inputs 5 and 6; the first is the writing command (in...5) and the second clearing command (in...B). Despite the fact that inputs are exe­cuted independently, we use them as one combined fuzzy-crisp variable as shown in Table 12.2.

We can find the described register in the library of building blocks in Fig. 12.2 under the name FTDCreg. In order to show how such a register works we make a MATLAB simulation program as shown in Fig. 12.24. From the library we choose FTDCreg block and put its inputs in...1, in...2, in...3, and inA to sources Repeating Sequence2, Repeating Sequence3,

ftdear

C ; 1 : : : ::::

:/ \:: ::/ \: : 0.8 ••••• ····J-··+···-f----- -----+---)----\---+---

T / : :\: : / : : \ :

0 .6 ----- --r-+-----:-\-[----- -0·(;11---1+----1-\--:--- --

.. 11\\i 1 'J\ 40 60 80 100 120 140 160 180 200

Tirre (Seconds)

Figure 12.22. Clear action of FT memory cell at t = 100 s.

MATLAB SIMULATIONS OF FUZZY CIRCUITS 369

Figure 12.23. Testing of FTDC register of four fuzzy-bits, FTDCreg.

Table 12.3. Data specifications for TFDC register simulation

Time-points

t = {O, 1, ... , 2OO} tt = (0,0,200) t2 = (0,100,200) t3 = (0,170,200) t4 = (0,200)

Membership at t;

J1-1 = (1, 1,0) J1-2 = (1,0, 1) J1-3 = (0, 1,0) J1-4 = (0, 1, 1)

Input fuzzy set Ai

total space Al = (0,0,0, 200)p A2 = (0,0,0, 100)p U (100,200,200, 2OO)p A3 = (0, 170, 170,200)p A4 = (0,200,200, 200)p

Repeating Sequence4 and Repeating Sequence5. respectively. Into sources we set membership data as shown in Table 12.3 or in Fig. 12.25.

During simulation time 0 - 200 s we want to enter input data into register at 20, 60, 120 and 160 s. Of course before entering we have to clear previous data. This clearing shall be at 18, 58, 118 and 158 s., just before writing. Write input ilL5 and clear input ilL6, the last two inputs, respectively, on the left side of block, are in this way running at the time of simulation in accordance with Fig. 12.26. Input ilL5 can be used as the clock by which we enter data into the register. In case we want to separate clock signal from writing data , we can in Fig. 12.23 substitute all 2min by 3min where the third input is designed for the clock.

In Fig. 12.27 we can see the result of storing, in register FTDCreg, data prepared in this way. If we compare membership values at moments 20, 60, 120 and 160 with their respective values in Fig. 12.25 we see that they are equal. In the register at the time of observation t of fuzzy

370 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

Figure 12.24. Inputs in..5 and in..6 for f11)Creg shown in Fig. 12.23.

ftdregi

, I • I , , • • ,

1 ----- ~ -----r---~-----(--j------~-----r----+- --j-----

40 60 Time (Seconds)

Figure 12.25. Membership input data generated with Repeating Sequences 1 - 4 for ITDCreg.

system following membership relations we have

t = 20: J1Al(t) > J1A2(t) > J1A3(t) > J1A4(t) , t = 60 : J1Al (t) > J1A2 (t) > J1A3(t) > J1A4 (t) , t = 120: J1A3(t) > J1A4(t) > J1Al (t) > J1A2(t) , t = 160: J1A3(t) > J1A4 (t) > J1A2(t) > J1Al (t),

which enable time analysis of events with fuzzy sets AI, A2 , A3 and A4 if their membership functions J1Al(t), J1A2(t), J1A3(t), and J1A4(t) appear.

MATLAB SIMULATIONS OF FUZZY CIRCUITS 371

Rdreg i

input 5 (Write new value) 1 .•.••••.•• ~ ••••••••••• ; ••••• ~ ••••••••••• ; •••••••••• ~ ••••• .. .. ,. ,. .. ..

0.5 0_- -- ---- - ~-- - --

o

Input 6 (Clear old value)

. .... . . . 0 .5 ---- :-----~----- ~-----~--- -- ~----- ~ - ----~- --- :---- - ~-----

, • I , , , , • , , . . , , . , . . , , . . . , . . . , , • , I , I , • . . , . . . . . . , . , . , . . . .

°0~~2~0--~40--~60--~BO--~'O~0~12~0--'~40--'~60--'~BO--~~0 Time (S. l;ond8)

Figure 12.26. Correlation between inputs in..5 and in_6 of FTDC register block.

ftdregi

IJ . . . . . . . i . 1 ----0:00---:------:------:---- -:------;------:-----:---3--:---- -

: 1: : : : : : : . . . . . . " .., 0.9 ..... f---'2'-'-: --l~ ... .. ; ..... ; .... . . ~ .... . ; .... .' 4 :

: 1: . : :: 4 : 2 :

O.B ..... .. ... j .. ... i ··· · ·i· ····j·····jj---'-'----fl----"--; , . , . , . . . , . . .

0.4 ..... ·· ··· ~ ·· ···l· =+~:::t:=~:t::::jr---'-' t: --11-···· ;····· 4 •

2 : 1 : 0 .2 ----- -----~-- - -- --- --l- - --- J-----jl--=-+--If---+- --j

3 :

4 :

20 40 BO eo '00 '20 140 'BO '90 200 Tirre (Seconds)

Figure 12.27. Four membership values stored in FTDCreg.

In Fig. 12.24 are three observations of results: Auto-Scale Graph, Auto-Scale Graph1 and Auto-Scale Graph2. The first shows outputs from a register like Fig. 12.27, the second shows input memberships functions as in Fig. 12.25 and the third shows correlation between iD-5 and iD-6 like Fig. 12.26.

From the above simulation of register by FTC memory cells it is ev­ident that a register set in such a way is quite applicable for hardware realization of fuzzy processing.

372 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

6.3 Fuzzy Data Shifting and Delaying We have just examined the FTOC register as a possible means of

storing membership functions of fuzzy sets. By analogy with binary computer design, we are going to name such a building block, memory register. Such a register is actually a buffer between two subsystems with different working speeds. So into memory register we can write information at a certain time and from the register recall the same in­formation at any time later. Besides memory registers in binary systems there are also shift registers, usually to shift the contents from memory cell i to cell i + 1 or from cell i + 1 to i. An example of the shifting of memberships, of course in the domain of the building blocks, is given in Fig. 12.2.

The contents in shifting register will be for us the membership /-Lx of fuzzy set X. If we shift this contents in time space we come to functions x(t), which lead us to the processing of time-dependent fuzzy sets that we have examined in previous chapters. We have met fuzzy set OK A where K is fuzzy set in time space.

Let us choose from the library in Fig. 12.2 a register of four fuzzy bits FTDCshift and look at shifting its contents. In Fig. 12.28 a logic scheme of such a register with four fuzzy bits is shown. The register has three inputs: iD.-l for writing control, iD.-2 for contents we want to store in the cell and iD.-3 for clearing control of all memory cells. Outputs out_l to outA are original outputs Ql, Q2 , Q3, Q4, while outputs out_5 to out_8 are reversed outputs: Q1> Q2, Q3, Q4, respectively. If Qi = /-Li then Q i = 1 - /-Li·

Figure 12.28. Four fuzzy-bit shift-register with FTDC memory cell.

Let us observe the above register when operating by the scheme in Fig. 12.29. The shift register is set on the basis of FTOC memory cells that can follow monotonic functions within fuzzy interval [0,1] . But

MATLAB SIMULATIONS OF FUZZY CIRCUITS 373

illlr-----------------~·

!} lI ' p,a1In,

C4:qulnoe3

Figure 12.29. FTDC shift register for memberships with monotonic increasing and decreasing behavior.

since a triangular or other membership J.tK is composed of monotonically increasing and monotonically decreasing functions (front and rear side of triangle J.tK), one register is not sufficient. Taking two of them - one for increasing part (FTDCshift) and one for decreasing part (FTDCshift 1) - we compose the contents of both registers based on min( Qli, Q2,4+i) , i = 1,2,3,4. Of course we must note when the memberships function changes from inclination to declination. For this purpose SIMULINK provides a block for derivation Derivative1. First we amplify output of this block strongly and then cut it at value 1 with Saturation. We apply the resulting signal as argument for the Clear/Write action of register FTDCshift1. Block Pulse Generator gives us the Write command into FTDCshift and FTDCshift 1. We have the possibility of two different functions of input data: It represents monotonically increasing function and I2 an initially increasing and then decreasing characteristic. We observe input It by Auto-Scale Graph1 and input h by Auto-Scale Graph. For the input It we actually need only upper register FTDCshift . hand h are fuzzy sets.

Based on the simulation scheme in Fig. 12.29 and input data

tl = (0,40,80,120,160, 200), J.tl = (0,0.1,0.5,0.9,1,1), It = (0.1/40,0.5/80,0.9/120,1/160,1/200),

374 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

and

t2 = (0,51,100,101,200), ~2 = (0,1,0,0,0), 12 = (0,51,51, 100)p ,

we obtain the following results, displayed in Fig. 12.30 on Auto-Scale Graph1. h without shifting is marked with 0 0 and shifted memberships are marked with 0 10 , 0 20 , 0 30 and 0 40 . Input data 12 in Auto-Scale Graph is similar. Block Pulse Generator gives a periodic signal of 10 s, simulation time is 200 s.

shiftreg

, ,

1 -----j-----i------1-----[-----1---~~+--~---;-~-;~: f~ '1 O.B ----+----i-----+----<~~~ , -T---'-----

! ! ! ~~ '" 0.6 -----~------:------~2ii--~A --:-----~----+----

: : I-' K~ '" : : 3Q'" ,','

0.4 -- ---;-----~- -[)--:K ---,-----,-----, -----,-----: ko ." l i 1 i : D: K~ :::::

0.2 - - - - -; - -- - - ~- - -- ~- -- -- -:. - - - - - ~- -- - -: - - - - -..:. - - --

Ol~: ~~~U~!~! l-! -L'-l o ~ ~ ~ ~ 100 1~ ~ 1W 1~ ~

Tirre (Seconds)

Figure 12.30. Four fuzzy-bit shifting of a monotonic increasing membership function of K=h.

At first sight FTOC memory cells appear to be deficient as building blocks of shift register, since they cannot react to monotonically increas­ing and monotonically decreasing functions. Because of this character­istic we have in Fig. 12.29 two registers FTDCshift and FTDCshiftl instead of one. This characteristic is useful when we go from fuzzy mo­ments to language attributes after, much after, before and similar ones that accompany fuzzy moments. As an illustration we will look at Fig. 12.32. By removing blocks FTDCshifti and 2min from simulation scheme in Fig. 12.29 we obtain a plot similar to Fig. 12.31. The only difference is shown in Fig. 12.32 where we see that delays refer only to the first side of triangle, hen they continue towards infinity which leads us to interval type [onK,+oo), n = 0,10,20,30,40.

So much for temporal shifting of membership of fuzzy set K. Let us take a look at membership delays enabled by building block FRSdelay in the library TSNORM.M in Fig. 12.2. We see the block itself in

MATLAB SIMULATIONS OF FUZZY CIRCUITS 375

shiftreg

J.1-

1 • , , • , • , • • -----r-----/~· - ----. -- --~j~~--T--'T----] ----T---0.8 -----1~~1-- -~ -- -- -- ·------t----- :-- ---:-- -- '1"---0 .6 -----1/- -- -- -" -- -- -- --+-----f-----l----- ~ -----

0.4 --I : -----\ -- -- -----r-----j----- j-----

o:~ --~ -- --r \ n----- :-- -- -~-----o 20 40 60 80 100 120 140 160 180 200

Tirre (Seconds)

Figure 12.31. Four fuzzy-bit shifting of a triangle membership function of K = h.

shiftreg

Tirre (Seconds)

Figure 12.32. Delay of attribute much after, denoted by interval [on K,+oo) for n = 0, 10,20,30,40.

Fig. 12.33. Instead of FTDC memory cell let us take the FRS memory cell for a change, so that S = R which gives us an FD memory cell. However, instead of the FRS cell we could have taken simply an FD cell which would lead to the same result . The block FRSdelay has only one input in...i and four outputs out_i, out_2, out-3 and outA with increasing delay. Of course, in order to spare fuzzy hardware we also have complementary outputs out_5, out_6, ouL7 and out_8.

With these building blocks we can construct the fuzzy logic model in Fig. 12.34. In one block we have a delay of 4 s. if clocked with 1 s. repetition. As we have four blocks linked into a chain, we deal with a

376 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

Figure 12.33. Four fuzzy-bit delay performed with FRS memory cells.

Rep.oIin 9 FTDcell

FSRdeiay

FSRd I~ FSRdel"1<3 FSRdelay1 e

Sequence

Figure 12.34. Delay of 16 time units with two output functions, D16 K and [D17 K, +00).

delay of 4 x 4 = 16 s. In the model we also see the FTD memory cell as an example by which we can make any delay combinations of membership functions on outputs of different delays 0...;- 16 s. Repeating Sequence generates the following input function

t = (0,50,100,130,160,180,181,200), J.l = (0,1,0,0,1,0,0,0) .

Given membership is the maximum of two triangle memberships, for fuzzy sets

K = Kl U K2, J.l = max(J.ll,J.l2), Kl = (0, 50,50, 100)p, K2 = (0,130,160, 180)p.

In Fig. 12.35 we see five membership functions of: KI, K2 , D16 KI, [D17 K 1 , +00), and D16 K 2 .

MATLAB SIMULATIONS OF FUZZY CIRCUITS 377

srdelay

~ .-~----~----~----~----~~

: 17 • IP K1iro)

08

06

40 60 Tirre (Seconds)

Figure 12.35. The result of Auto Scale Graph block from Fig. 12.34.

7. MODEL OF FUZZY NEURON In this Chapter we have so far examined MATLAB simulation models

of several basic fuzzy building blocks where the presence of time is im­portant. In this Section we are going to observe a larger system of fuzzy inference set up by fuzzy blocks that we met already. We will name this system Yamakawa's fuzzy neuron [6]. In fact, this system can also be taken as a fuzzy building block by which we can design even larger systems, fuzzy neural networks. Fuzzy neural networks are essentially different than ordinary neural networks composed of ordinary artificial neurons with scalar inputs, scalar (positive and negative) weights and activation (sigmoidal) function [8].

Pi!

Figure 12.36. Yamakawa's fuzzy neuron.

The transition from ordinary neuron to fuzzy neuron has been defined by Yamakawa [6, 7] amongst others. In Fig. 12.36 we show a model of

378 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

Yamakawa's fuzzy neuron where index i implies that it is taken as one of the neurons of a certain neural net. Such a neuron has, instead of scalar input signal, an input vector Xij at j-th synapse, j = 1,2, ... , n. The synaptic weight Wij is replaced in the fuzzy version by fuzzy weight which is a fuzzy number - a term with trapezoidal membership function M Fij. Activation function is linear in the fuzzy case and we approach to the relevant calculation by the minimum of inputs. Weighting of j-th synapse, using a scalar Pij but, in case of inhibition a complementary scalar 1-Pij, is determined on the basis of the MIN-MAX principle we have been used to in the context of fuzzy inference. So we have

Pij = max (min(J.Lijk, Xijk)) k=l, ... ,m

(12.3)

where k is the current index of terms of a particular synapse and the components of vector Xij respectively. The scalar output value of i-th fuzzy neuron is

Yi = ~n(pij ) . (12.4) J

Block M Fij with annotation of Max in Fig. 12.36 represents the MIN­MAX process over input vectors, Xij, and terms, tij = M Fij . Terms are those fuzzy numbers that allocate characteristics to the i-th neuron. So in some h-th neuron, h i= i, terms are different from terms in the i-th neuron and the same vectors Xj can enter into the h-th neuron, depending on the way the net with several fuzzy neurons is designed.

As an example, an implementation of handwritten character recogni­tion can be found in [6]. Circuits are implemented with fuzzy ECL tech­nology (a non-linear analog technology). Our basic goal in this Section is to present Yamakawa's neuron by simulation building blocks discussed in this book.

If we look at block scheme of the chip of a fuzzy neuron in [6] we see that the central part of the chip is designed on the basis of analog pro­cessing circuits while access to central part is enabled by classic binary registers where one memory cell can save only value 0 or 1. Consequently on the chip a lot of D / A converters are necessary to bring us from codes to analog values of fuzzy interval [0, 1]. In our book we have become familiar with fuzzy memory cells by which we tried to realize shifting, storing, delaying and other kinds of fuzzy registers. A dimension of 4 fuzzy bits for these sequential circuits was used only in order to explain the subject in a brief manner.

In Fig. 12.36 we see that only input variable into fuzzy neuron is a fuzzy vector Xij' M Fij are variables as well. In the basic scheme

MATLAB SIMULATIONS OF FUZZY CIRCUITS 379

of fuzzy neuron this is not shown because i is an index of the neurons constituting the net.

For the requirements of memory we introduce FTDCreg that we exam­ined in the context of Figs. 12.23 to 12.27. We decided that index k runs between 1 and 8, therefore we must take 2 x FTDCreg to achieve eight fuzzy bits. If we want to change i-th neuron into h-th neuron, h i= i, we need one time-step (paralel mode). In our example it is a step of simulation in which we are trying to delete old memberships MFij from FTDC memory cells. We need the next time-step to fill the same cells with new memberships M Fhj . The next time-step is needed to execute inference. In this time-step M Fij are stored in registers, as required by Fig. 12.36. The external memory is not used in one time-step execu­tion of the neuron simulated. The memorizing function is performed by FTDC registers inside the neuron.

FTOCreg2 out_ 16

Figure 12.31. 8 fuzzy-bit FTCD register.

Now let us go to the actual simulation of the observed fuzzy neuron. We suppose that there are 9 time-steps available within one simulation processing. As this is a descriptive example of simulation one step shall be simply Is , although, we could have chosen any other time unit. We would need 9 time-steps if we had a serial mode of neuron functioning. In this case 8 steps would be used for 8 calculations in space X where fuzzy sets 'Xij and F Mij are located. The 9-th step would be necessary

380 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

to get to the MIN-MAX result at the output of neuron. In our case we set fuzzy neuron parallel-wise as it contains no serial shifts or delays which would require a lot of time-steps. In the first time-step we clear old contents from registers FTDCreg, in the second we enter memberships M Fij parallel-wise into the same registers, and in the third time-step the result Yi is obtained.

Figure 12.38. 32 fuzzy-bit unit Half1.

In Fig. 12.37 we see an 8-fuzzy-bit store register. Each fuzzy number M Fij needs one of them, which means that there eight in the neuron. We link 8-fuzzy-bit registers into two 32-bit units in such a way that to every 8-fuzzy-bit FFTDC register we attach a 16-input gate, 2x8Min, in order to form a minimum of Cartesian elements (J.Lijk, Xijk). Behind such gates there follows also an 8-bit maxO gate as required by expression for scalar Pij ' The first such group of units is called XlxMFl and the complete 32-bit unit is called Half 1. This unit, seen in Fig. 12.38, has 4 outputs: out_l = Pill out_2 = Pi2, out_3 = Pi3 and outA = Pi4. Inputs

MATLAB SIMULATIONS OF FUZZY CIRCUITS 381

in...9 and in...10 in Fig. 12.37 as well as inputs in...33 and in-34 in Fig. 12.38 contain information for clearing of and writing into registers.

OUL10

HII111

Figure 12.39. Complete circuit of fuzzy neuron.

In Fig. 12.39 we the see complete circuit for a fuzzy neuron. To the units Half 1 and Half2 only 8-fuzzy-bit gate Bmin is attached which satisfies the last minimum giving us output Yi in Fig. 12.36.

Block scheme for the neuron circuit in Fig. 12.39 is given in Fig. 12.40. In the lower part we have two generators of control signals, Clear and Write. The first defines the moment of clearing register cells FTDC and the second the writing of new contents into these cells. Timing of both signals is given by vectors

tClear = (0,1,2,3,4,5,6,7,8), Clear = (0,1,0,0,0,0,0,0,0) , tWrite = (0,1,2,3,4,5,6,7,8), Write = (0,0,1,0,0,0,0,0,0) .

Now let us determine the characteristics of neuron i from the aspect of membership Fij. We can see all terms in Fig. 12.41. Terms are drawn

382 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

~ Auto·Scale

Graph

Clear

Figure 12.40. Block scheme of fuzzy neuron that can be used in fuzzy neural nets.

smoothly, but we calculate them discretely in the domain of vector x = [1:1:8] in MATLAB notation. The vectors Xj in Fig. 12.42 are given in a similar way.

From the data given in Figs. 12.41 and 12.42 we make a minimum for Cartesian elements (tLijk,xjk),with the result seen in Fig. 12.43. The maximum over index k is shown in Fig. 12.44. As Yi is the minimum value in the last figure, we obtain the result Yi = 0.333 at index j = 8.

After the simulation we get result Yi = 0.333 in the display Auto-Scale Graph which is located, as we see, at the output of the neuron. Fig. 12.45 shows us that the result appears at the beginning of simulation step 2. The reason for this has been explained earlier.

Yamakawa's fuzzy neuron in Fig. 12.40 with all its supports (see simulation Figs. 12.37 to 12.39), represents the MATLAB&SIMULINK routine that starts the simulation immediately after we draw the scheme and click on Start in the Simulation menu. We will not consider this routine from the aspect of MATLAB code, since there was no need to

MATLAB SIMULATIONS OF FUZZY CIRCUITS 383

0 .8

0.7

0 .6

10 .5

0.4

0.3

0 .2

0 .1

IIIFDA.TA

Figure 12.41. Memberships Fij for fuzzy neuron in Fig. 12.40, j = 1, ... , 8.

"""TA

I 0.9 I 0.8 I

I- X6 0.7 I I. 0.6 I I

io.s I I ,

I I x 3

:e.0.4 I I I / 0 .3

I I 0.2 II

II, 0.1 /j

Figure 12.42. Input fuzzy vectors Xij, j = 1, .'" 8.

program the routine. We came to it simply by drawing the model of the neuron. This routine is named FNEURO.MDL. The ending ' .MDL' means that we have to deal with simulation model and not with usual MATLAB program that ends with' .M'.

Simulation model FNEURO.MDL requires that input data are set correctly in the working space. For this purpose we construct execu­tion programs MFDATA.M and XDATA.M. The first takes care of the correct presentation of terms M Fij and the second of the correct set­ting of input vectors Xij. Besides this task of program XDATA.M we have to stress that this program has the additional function of checking the correctness of the result given by FNEURO.MDL. For this purpose XDATA.M also includes processing of the MIN-MAX procedure of the

384 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

o 0

Figure 12.49. Minimum of Cartesian elements (/-Li jk, Xijk).

0.9

0 .8

0 .7

06

05

0.4 .. _ .... ____ .. .. .... !']~nl~_~~~ YL _ .... _ ...... .. .. .. .. .. .... _ 03~, ----!------!------7-----!"----,!----!----!.

Figure 12.44. Maximum of min[(JIijk , Xijk)] over index k = 1, 2, ... , 8.

observed. neuron. Processing is direct and independent of model speci­fications and simulation. The sequence of calculation and simulation is given by sequence MFDATA.M - XDATA.M - FNEURO.MDL. Program XDATA.M gives us Figs. 12.41 to 12.44 before we start the simulation. The result output = Yi given by program XDATA.M is the same as the one we get by FNEURO.MDL. This proves however that the chosen simulation neuron circuits Min, Max and FTDC work correctly. For us it is important above all that FTDC memory cells and FTDC registers work correctly, since they are not taken from the literature but are the result of our considerations.

MATLAB SIMULATIONS OF FUZZY CIRCUITS 385

fneuro

0 .35 -----+-----+------ +-----+--- -- -i---yr -i- ---- --i---- --. . . · , . , . . .

03 - - - - - - -( - - - - - ~ - - - - - - -~- - - - - - - j -------j -------~ -------~ ------· . . . , , .

0 25 -- - ----:----- -- -:- --- --- -:- - - - --- 1---- -- -i-- ---- -i ------ -:----- -0 .2 -------r--- -- -r ------ r--- -- -1 -- -----1- -- ---o r ---- -- -r---- --

0 .15 - - - - -- -~- - - - - -+ -------;- ------ ~------ -~ -------~ _e_ - - - -~ -_. ---· , .. " · , . . . . .

o:~ ::: : :::~ --::: _:t:::::: J::::::: j:: ::::: j::::::: t:::::::t:: :::: · . . · .

Tirre (Seconds)

Figure 12.45. Output of fuzzy neuron on Auto-Scale Graph in Fig. 12.40.

fneuro

Tirre (SecondS)

Figure 12.46. Working FTDC-register for MF1j through simulation period.

For this reason we are going to observe the process of simulation of a neuron in more detail. In Fig. 12.46 we see how, in the second step of simulation, FTDC register for M Fit gets filled up with term tl from MFDATA.M. Function M represents the external memory that is the working space of computer that is concerned with control over the observed fuzzy system. While at later steps of simulation, M = 0, i.e. when the external memory is no longer present, the contents in FTDC register remains. This is the memory characteristic of this register.

Longer simulation times can mean that we have more processing time available for the inference system containing the observed neuron. But larger number of simulation steps can on the other hand mean that the

386 DESIGN CONSIDERATIONS OF TIME IN FUZZY SYSTEMS

inference system has the same time at its disposal, but that division into time steps is finer. In this connection it is interesting to observe Fig. 12.46 if we increase the simulation period by factor 10. We see the resulting effect on MFil in Fig. 12.47, which shows explicitly that the FTDC register stores membership values to the end of the simulation.

fneuro

. " , I I , ,

1 --+---~---:-__ : _-:-___ ;-_;-__ I . 1 1 . i 1 .

0.8 -- ---:--- - - -- -:- --- - -- ~- - -- --- !-- ---- -i- -- -- --: ------ -: ---- --, , , ,

, . , . . . 0.6 • • --T------T---- --T ----- -r-- --- -1----- -- ~ -------r---- --

I I , I • , , , , , , , 0.4 - -- --;--- -- -- -;- --- - --~- - --- - -~-- - - - - -~--- -- -- t -- -----~ ---- --. ,. .. · .. · .. · .. 0.2 - --- -i--- -----~-- ----~- ------,- ----- -! --- - - - -! ---- - --; - - - - --

o o 10 20 30 40 50 60 70

Tirre (Seconds) 80

Figure 12.47. Simulation of fuzzy neuron over 80 s.

Programs MFDATA.M and XDATA.M are given in the collection of MATLAB programs in Appendix C. Essential variables for MIN-MAX processing of neuron are matrix mxm, vector vekm and result output. The first variable is shown in Fig. 12.43 and the last one in Fig. 12.44. Programs MFDATA.M and XDATA.M can, without any problem, be integrated into one. We can even abridge them considerably. But in order to keep them transparent we will leave them in unabridged form. These programs have a reduced volume of data for M Fij and Xj. Only examples for the first (M Fil, Xl) and last case (M Fis, Xs) are presented. This reduces the number of pages in this book without losing the clarity of the program.

8. CRISP PROCESSOR - FUZZY PROCESSOR

In this Chapter we have discussed the building blocks from which we can design fuzzy systems from the aspect of (fuzzy) time. Contemporary fuzzy inference systems are still mainly designed independent of time, everything inside them happening at moment t. Time dimension delays, derivatives, integrals etc. are external to the inference machine that represents the main part of a fuzzy processor. However, the building

MATLAB SIMULATIONS OF FUZZY CIRCUITS 387

blocks in the library TSNORM.M in Fig. 12.2 demonstrate that time dependencies can be incorporated into inference machines leading to fuzzy processors that will be able to process uncertain or ambiguous information from the aspect of time as well.

Processors in today 's ordinary computer systems can only directly or rationally process precise, doubtless information. Inexact or doubtful information is processed on the basis of probability calculus, statistics, time series etc. resulting in non-directness and ineffectiveness of process­ing. Crisp processors process doubtless information in such a way that time dependence is taken into account. A crisp processor is composed of an arithmetic-logic unit (ALU) and also a working memory. From a basic knowledge of computer science it is known that everything relat­ing to memorizing is related to temporality. Therefore, a contemporary crisp processor would be better called an "automaton", rather than a combinational decision system.

The up-to-date fuzzy processor is, in principle, an inference machine which is a fuzzy combinational decision system. In comparison with the crisp processor, it is a kind of ALU, but the fuzzy working memory is covered non-optimally or represented simply by the working space of the crisp computer on the basis of which the fuzzy system is set up. In a crisp processor one membership value J.L requires a whole computer word while in our systems this value is represented by one memory cell that can, as we know, store information of one fuzzy bit. This situation is historically conditioned, since not so far back in the past it was believed that analog (fuzzy) memory cannot be set up in a rational form. It is possible that such an opinion will soon be forgotten, since designers of fuzzy hardware equipment design not only fuzzy processors but also fuzzy computer systems that will more and more replace contemporary crisp computer systems.

We hope that fuzzy inference machines will be increasingly supple­mented with memorizing capabilities, in other words, with time func­tions. Instead of variables like

dx d2x x(t), dt' dt2 , (x(t-l),x(t-2) ... x(t-n)) ,

an so on, which have been so far external to the inference machine (com­pare Figs. 7.2 and 7.3), we would like to be able to input only x, with the time modifications of variables being performed inside the machine. In this way the number of inputs into various fuzzy systems, particu­larly control systems, would be reduced, which would have a favorable influence on fuzzy design. This is at the moment not entirely the case when we have to deal with high number of inputs and multivariability.