Analytic psychical modeling

Material Information

Analytic psychical modeling mathematically modeling Freudian psychology using control theory
Roulier, D. Scott
Place of Publication:
Denver, Colo.
University of Colorado Denver
Publication Date:
Physical Description:
xi, 74 leaves : illustrations ; 29 cm

Thesis/Dissertation Information

Master's ( Master of Science)
Degree Grantor:
University of Colorado Denver
Degree Divisions:
Department of Electrical Engineering, CU Denver
Degree Disciplines:
Electrical Engineering
Committee Chair:
Fermelia, Al
Committee Members:
Thomas, Joe
Hickey, Mike


Subjects / Keywords:
Psychoanalysis -- Mathematical models ( lcsh )
bibliography ( marcgt )
theses ( marcgt )
non-fiction ( marcgt )


Includes bibliographical references.
General Note:
Submitted in partial fulfillment of the requirements for the degree, Master of Science, Electrical Engineering [Department].
General Note:
Department of Electrical Engineering
Statement of Responsibility:
by D. Scott Roulier.

Record Information

Source Institution:
|University of Colorado Denver
Holding Location:
|Auraria Library
Rights Management:
All applicable rights reserved by the source institution and holding location.
Resource Identifier:
26032848 ( OCLC )
LD1190.E54 1991m .R68 ( lcc )

Full Text
D. Scott Roulier
B.S., Clemson University, 1986
A thesis submitted to the
Faculty of the Graduate School of the
University of Colorado at Denver
in partial fulfillment
of the requirements for the degree of
Master of Science
Electrical Engineering

1991 by D. Scott Roulier
All rights reserved.

This thesis for the Master of Science
degree by
D. Scott Roulier
has been approved for the
Department of
Electrical Engineering
A1 Fermelia
Joe Thomas
cvtt .ml
Mike Hickey

Roulier, D. Scott (M.S., Electrical Engineering)
Analytic Psychical Modeling: Mathematically Modeling Freudian Psychology
Using Control Theory
Thesis directed by Associate Professor A1 Fermelia
It is the purpose of this thesis to demonstrate the application of control theory in
analytically modeling the behavior of the mind, the basis for which is the mechanization
of Freudian psychology. Sigmund Freud introduced the concept of spatial
representation and the system dynamics of the psychical elements identified as the
conscious and unconscious, perceptive conscious, preconscious and repressed instincts
and the commonly familiar ego, id and super-ego. The initial math model is built upon
these structures and their interactions as formulated by Freud in his text The Ego and
the Id.
Sigmund Freud developed his theories around the structural elements of his
model and refined them through clinical observations. The "psychological apparatus"
is modeled assuming a linear time invariant system, so all of Freud's theories of
development are excluded. Particular theories explored here are Object Cathesis, the
Pleasure Principle, the Reality Principle and the Tendency Towards Stability as outlined
in his book Beyond the Pleasure Principle. Energy concepts and signal modulation are
introduced into the mathematical schemes to facilitate these fundamental properties.

Further effort is made to expand Freud's psychological theories (not in their
entirety) to actual clinical studies of the brain, the commonality of which can be
described through the use of controls algorithms, which is indeed the premise of this
thesis. The basis for this is the evaluation of electroencephalograms (EEGs) and neural
stimulation in the brain and their possible correlation to Freudian psychology as
pertaining to The Interpretation of Dreams.
The ultimate direction to which this approach may lead is the eventual estimation
and identification of the physical states that can be linked to Freudian psychology and
expanded to encompass many of the attributes of general psychology and its biological
sibling physiological psychology.
This abstract accurately represents the content of the candidates thesis. I recommend
its publication.

I wish to express my appreciation to Dr. Alfred Fermelia, Al, for his dedication,
understanding and insight and thanks to those around me for being so patient this last

Figures ..................................................... ix
Tables ...................................................... xi
1. THE FREUDIAN MECHANIZATION.................................... 1
The Conscious, Unconscious, Preconscious and Repression ... 1
The Conscious Ego........................................ 3
The Id................................................... 5
The Unconscious Ego, the super-ego ...................... 7
The Two Classes of Instincts ............T ._......... 9
The Psychical Dynamics of the Mind...................... 10
The Mathematical Models................................. 13
2. FREUDIAN CONCEPTS ........................................... 19
Libido and Object Cathesis.............................. 19
The Pleasure Principle and the Reality Principle ....... 21
The Tendency Towards Stability ......................... 22
The Mathematical Representation......................... 23
3. THE PSYCHICAL MATH MODEL..................................... 36
Simulation of the Model ................................ 36

4. FREUD AND THE BRAIN......................................47
Relating the Psyche to Elements of the Brain....... 47
5. CONCLUSIONS AND RECOMMENDATIONS..........................53
Conclusions ...................................... 53
Recommendations for Further Research .............. 54
C. MATLAB DESIGN FILES................................. 62
Code for Personality Parameters ................62
Code for the Psychical Model .................64
Code for Frequency Domain Simulations . ....65
Code for Time Domain Simulations ...............68

1.1. Diagram of the Conscious and Unconscious............................. 3
1.2. Diagram of the Conscious Ego, Perceptive Conscious and Preconscious. 5
1.3. Diagram of the Id.................................................... 7
1.4. Diagram of the Super-Ego............................................. 9
1.5. The Complete System................................................. 13
1.6. Block Diagram of the Ego...........;.......................... 14
1.7. Block Diagram of the Complete Psychical Model....................... 18
2.1. Illustration of the Pleasure Principle and Region of Stability. .... 22
2.2. Time Response and Corresponding PSD............r ................... 25
2.3. The Principle of Amplitude Modulation............................... 25
2.4. a. The Object Signature............................................... 26
2.4. b The Emotionally Modulated Object Signature.......................... 27
2.5. The Block Diagram with Emotionally Modulated Inputs................. 28
2.6. a. Emotionally Modulated Output from the Id.......................... 30
2.6. b. Bode Plot of the Linear Low Pass "Repressive" Filter............... 30
2.6. c. "Unrepressed" Output from the Preconscious......................... 31
2.7. a. "Reality" as Perceived by the Perceptive Conscious................. 31
2.7. b. Output from the Ego to the Id...................................... 32
2.7. c. Instinctual Input to the Id........................................ 32
2.7. d. Combined Input Command as Perceived by the Id...................... 33

2.8. a. Root Locus of the Ego....................................... 34
2.8. b. Open Loop Bode Plot of the Ego.............................. 35
2.8. c. Closed Loop Bode Plot of the Ego............................35
3.1. The Block Diagram with Emotionally Modulated Inputs with Labels
Corresponding to Figures 3.1.a Through 3.1.j................ 38
3.2. a. "Reality" as Perceived by the Perceptive Conscious........... 40
3.2. b. Output from the Super-Ego to the Ego......................... 40
3.2. c. "Unrepressed" Output from the Preconscious................... 41
3.2. d. Combined Input Command to the Ego............................ 41
3.2. e. Output Signal from the Ego to the Id......................... 42
3.2. f. Instinctual Input to the Id.................................. 43
3.2. g. Combined Input Command to the Id............................. 43
3.2. h. Instinctual Input to the Super-Ego........................... 44
3.2.1. Output from the Id to the Super-Ego........................... 45
3.2. j. Combined Input Command to the Super-Ego...................... 45
4.1. The Lobes of the Cortex........................"v............. 49
4.2. The Limbic System............................................. 51
A. 1. Block Diagram of the Ego...................................... 58
B. 1. Block Diagram of Complete Coupled System...................... 60

3.1. Parameters of the Components..................................37
3.2. Gain Matrix K, Linking the Components.........................37
3.3. Object and Emotional Signal Definitions.......................38

The Conscious. Unconscious. Preconscious and Repression
Sigmund Freud, like most of Europe of that time, was influenced by the
industrial world of the early 1900s and the machines it produced; so much so that his
theories of psychology took on their own form of mechanization. Freud ingeniously
modeled the emotional dynamics that describe our behavior as a mechanism. It is this
approach that if followed spatially and functionally leads to- the development of a
mathematical model. He began his mental dissection by separating thoughts based on
our own sense of awareness. This lead to the fundamental premise of psychoanalysis
which is the differentiation of the mind into what is considered conscious and that
which is considered unconscious. This division, although limited by the science of his
day, was to describe both the invisible world of the mind the physical structure of the
brain. He states:
Consciousness is the surface of the mental apparatus; that is, we
ascribe it as a function to a system which is spatially the first one
reached from the external world and spatially not only in the functional
sense but, on this occasion, also in the sense of anatomical dissection
It is the conscious state which connects the external and internal worlds of our

psyche. The conscious is the element that passes all externally perceived stimuli inward
and all feelings and sensations outward. The definition of the conscious is that aspect
of the mind that at any moment, of which one is aware. In contrast, the unconscious
state encompasses all the elements of our psyche that remain isolated from the
The conscious is further divided into two components. The outer surface is the
perceptive conscious and the inner surface is the preconscious. All that we come to
realize, whether originating from the external world or from internal mental
displacements is brought to consciousness through either the perceptive conscious or
the preconscious.
It remains true, therefore, that sensations and feelings, too, only
become conscious through reaching the system perception; if the way
forward is barred, they do not come into being as sensations, although
the something that corresponds to them in the course of excitation is
the same as if they did [5,p.l6].
This is premised by understanding that what is conscious is synonymous to that
which the ego is aware. Thus, internal perceptions can arise from the unconscious and
apply force to the ego in a manner such that the ego is unaware of it. These latent
residues of memory, memory-traces, are easily accessed and arise through the
preconscious. Memory-traces are kept.for future emergence.
Freud believed the unconscious to be the source for all human behavior and can
be described only functionally and that it could never really be assigned to a region of
the brain. Regardless, conceptually he located the unconscious deep within our minds
and rested the conscious state upon it, in a way analogous to the tip of an iceberg with
the bulk of it left unseen beneath the surface. He attributed the greatest amount of
energy and dynamics to the unconscious and describes it as follows:

[W]e ... arrive at the term or concept of the unconscious along
another path, by considering certain experiences in which mental
dynamics play a part. We have found ... that very powerful mental
processes or ideas exist... which can produce all the effects in mental
life that ordinary ideas do..., though they themselves do not become
conscious [5,p.4].
Not all the sensations and feelings ascribed to the unconscious are capable of
becoming conscious without considerable effort. These elements are every bit as
dynamic and forceful as those of which we are aware, but they remain unconscious and
thus repressed. Figure 1.1. illustrates the mechanization. On the left is Freuds sketch,
on the right is a systematic representation. This block diagram represents the first step
to mathematically characterizing the mind as Freud perceived it.
External Environment
1.1. Diagram of the Conscious and Unconscious.
The Conscious Ego
It is to the ego that consciousness is attached; the ego controls
the approaches to motility that is, to the discharge of excitations into
the external world; it is the mental agency which supervises all its own

constituent processes, and which goes to sleep at night, though even
then it exercises the censorship on dreams. From this ego precede the
repressions, too, by means of which it is sought to exclude certain
trends in the mind not merely from consciousness but also from other
forms of effectiveness and activity [5,p.8].
The ego is the cluster of cognitive and perceptual processes
which include memory, problem solving, reality-testing1, inference-making and
the like that are conscious and in touch with reality [12]. A great deal
psychologically and physiologically is covered within the definition of the ego.
Perhaps the largest portion of mans understanding of the brain and its
functional processes lie in what Freud called the ego. Memory, problem
solving and inference-making are three properties related to the cortex of the
brain. Most importantly is the implication of logic at this level. Any logic here
would most certainly be modus-ponens based as in probabilistic approaches to
artificial intelligence. The ego it seems is less an emotional structure than it is a
logical one, functioning dynamically as a relay station of a sort. The ego would
rest in what is labeled M in figure 1.1. ,and is more definitively pictured in
figure 1.2.
1 With respect to modeling, reality-testing implies possibly a rule-based
(modus-ponens) memory processing control estimation of expected reality signals
versus actual real signals. By storing models and parameters separately, a great
deal of information could be kept with minimal effort. For example, I may store a
generic model of the human anatomy and many different characteristic parameters
of which I may access to model people with whom I am familiar (mom has green
eyes). If I am pursuing someone I think is my mother only to have this person turn
quickly around revealing her three red eyes, a large error signal would result from
the actual and estimated states. But upon further exposure and the adaptation of
my mental characteristics, my model characteristics for this person may very well
become a part of reality.

1.2. Diagram of the Conscious Ego, Perceptive Conscious and Preconscious.
The Id
Internal perceptions yield sensations of processes arising in the
most diverse and certainly also in the deepest strata, of the mental
apparatus. Very little is known about sensations and feelings; those
belonging to the pleasure-unpleasure series may still be regarded as the
best example [ of the id]. They are more primordial, more elementary,
than perceptions arising externally and they can come about even when
consciousness is clouded [5,p.l4].
The use of the word diverse hints at a multi-dimensional unconscious mind
of which the id is only one component. Freud further describes it as being linked to the
ego through the preconscious and dependent upon the states of repression, internal
perceptions can originate directly from the id through the pleasure-unpleasure
mechanism as sensations and feelings. In essence, the id is the primitive part of the
mind and is driven by animalistic instincts. It is the source of libidinous energy
demanding immediate satisfaction [12]. The dynamics of the id are closely related to

the instinctual behavior of man. Although Freud does not attempt to physiologically
locate the id, it is possible that the structures responsible for id-like functions do truly
lie deep within the mental apparatus and physically exist within the limbic system,
our animal brain. The limbic system is connected to the temporal lobe of the cortex and
because of this we are able to experience primitive feelings such as fear, anger and lust
[13]. Within the framework of Freuds model, these experiences are conscious ones
(assuming the ego = conscious => cortex). These would then have to be only the set of
feelings2 not repressed. Freud seems to support this concept.
The ego is not sharply separated from the id; its lower portion
merges into it. ... But the repressed merges into the id as well, and is
merely a part of it. The repressed is only cut off sharply from the by the
resistances of repression; it can communicate with the ego through the id
Figure 1.3. is the mechanization of the id. Notice where the id is positioned
inside the unconscious and that it connects the instinctual impulses (life and death
instincts) to the preconscious, either directly or via the repressive mechanism, and the
preconscious connects the id to the ego.
2 Refer to object cathesis. This is not to say that fear, lust and anger cannot be
unconscious emotions as well.

1.3. Diagram of the Id.
The Unconscious Ego: The Super-Ego
What has belonged to the lowest part of the mental life of each of
us is changed, through the formation of the ideal, into what is the
highest in die human mind by our scale of values.... It is easy to show
that the ego ideal answers to everything that is expected of the higher
nature of man. ... Social feelings rest on identifications with other
people, on the basis of having the same ego ideal [5,p.33].
The third component, the super-ego, comes from the differentiation of the ego
into what is conscious and what is unconscious. Unlike the conscious ego which
represents the external world of reality, the unconscious ego is the representative of the
internal world, the id. The super-ego retains all the characteristics of the ego. This
implies that the super-ego incorporates its own logical system as well. Even though
Freud does not explicitly say, Karl Jung (at one time a student of Freud) theorizes that
there is more than one form of logic. There is an unconscious logic which is based on

rules of association rather than inference as is the case in the conscious ego.
The super-ego includes more complex features and purposes than the ego.
These are referred to as the higher nature of man, our scale of values and is the source,
according to Freud, of all our religious beliefs. The super-ego, like the id, is driven by
instincts in much the same manner as the ego is by reality. The most influential
instincts of the super-ego are those associated with death.
Freud believed that it would be vain to attempt to localize the super-ego, even in
the conceptual sense as he did for the ego and id. But modem research indicates that,
like the id, brain structures can also exhibit super-ego-like properties. This is most
exemplary in the study of schizophrenia. Patients of schizophrenia often have religious
experiences, touching the face of God. Schizophrenia is a disease with physical
causes. Abnormalities in the limbic system may produce profound changes in
emotional behavior. Evidence linking the two has been found in the limbic electrical
activity seen in schizophrenic patients [6]. Thus physically, whatever is distinctly id
and super-ego within the unconscious is probably located in the limbic system, and is
even more likely, highly coupled in nature. Regardless, the super-ego can be modeled
spatially close to the id and as previously stated, acts as its representative to the ego.
This means that the super-ego must combine the forces of the id and the instincts and
relay them in its own dynamic way to the ego. Figure 1.4. illustrates this connection.

1.4. Diagram of the Super-Ego.
The Two Classes of Instincts
The relationship of the ego to perception is similar to the relationship between
the unconscious (super-ego and id) and instincts. Freuds theory of instincts evolved
as his concept of the psychical model matured. He first wrote of instincts in his paper
On Narcissism: An Introduction, published in 1914 and later formalized them in his
publication of Bevond the Pleasure Principle in 1920. Later in The Ego and the Id
published in 1923 as a continuation of Beyond the Pleasure Principle, he modified his
theory to include two principle types of instincts; those of life and death.
[W]e have to distinguish two classes of instincts... [The two
classes] comprises not merely the uninhibited sexual instinct proper and
the instinctual impulses of an aim-inhibited or sublimated nature derived
from it, but also the self-preservative instinct, which must be assigned to
the ego [5,p.37].

Sigmund Freud concentrates on the functionality and spatial orientation as
pertaining to the ego and id of the instincts rather than concerning himself with any
biological localization. But he does hint at literally locating these primitive drives in a
biological sense through the evolution of man [4], Indeed this may hold some truth
anatomically as evidenced by the delineation within our brains, the most primitive being
the brain stem and the source motivating both the preservation of species and self
preservation [13].
Freud stressed the fusion of instincts which correlates well with the highly
coupled neural nature of the brain stem. He describes the duality of instincts with
precise and exacting verbiage.
On this view a special physiological process would be
associated with each of the two classes of instincts; both kinds of
instincts would be active in every particle of living substance, though in
unequal proportions, so that some one substance might be he principal
representative of Eros.
This hypothesis throws no light whatever upon the manner in
which the two classes of instincts are fused, blended, and alloyed with
each other; but that this takes place regularly and very extensively is an
assumption indispensable to our conception [5,p.38].
Figures 1.3. and 1.4. show instincts as inputs into the id and super-ego, these
inputs are representative of both types of instincts. The predominate motivation for the
id is the life instinct which has the responsibility for the preservation of the species and
for the ego the death instincts are assigned which relate to the impulses of self-
The Psychical Dynamics of the Mind
From the onset of this chapter, it was the intention to develop a model of the

dynamic relations set forth by Freud in his mechanization of the psyche. Based on the
aforementioned descriptions a diagrammatical model can be assembled. Justification
for the connecting links comes from both Freuds descriptions (spatially and
functionally) and from supporting anatomical references. The model illustrated in
figure 1.5. explicitly incorporates the conscious, unconscious, perceptive and
preconscious states of the mind and the components of the ego, id, super-ego and
repression. The instincts and perceptions are forcing functions and therefore seen as
inputs to the system.
The ego gives mental processes an order in time as well as submits them to
reality testing. It interposes thinking and thus postpones motor discharges, preventing
us from responding on purely an instinctual basis. The ego receives inputs from the
perceptive conscious, the super-ego and the non-repressed output of the id. Freud
[The ego is] a poor creature owing service to three masters and
consequently menaced by three dangers: from the external world, from
the libido of the id, and from the severity of the super-ego. Three kinds
of anxiety correspond to these three dangers, since anxiety is the
expression of a retreat from danger. As a frontier-creature, the ego tries
to mediate between the world and the id, to make the id pliable to the
world and, by means of its muscular activity to make the world fall in
with the wishes of the id. ... Whenever possible, it tries to remain on
good terms with the id; it clothes the id's Ucs. commands with its Pcs.
rationalizations; it pretends the id is showing obedience to the
admonitions of reality, even when in fact it is remaining obstinate and
unyielding; it disguises the id's conflict with reality and, if possible, its
conflicts with the super-ego too [5,p.58].
The id and the super-ego exist within the unconscious. The id accepts
commands from the ego and passes on commands to the super-ego. Both receive
inputs from the instincts of life and death: the id predominantly responds to those of life
whereas the super-ego responds the those of death. The egos influence on the id is

largely unwanted and likewise the ids command to the super-ego is in conflict with the
super-egos desires. Both of them output commands to the ego, the id through the
repressive mechanism (the preconscious) and the super-ego via the perceptive
There are two paths by which the contents of the id can penetrate
into the ego. The one is direct [by way of the preconscious], the other
leads by way of the ego ideal [the super-ego]; which of these two paths
they take may, for some mental activities, be of decisive importance:
The ego develops from perceiving instincts to controlling them, from
obeying instincts to inhibiting them. In this achievement a large share is
taken by the ego ideal, which indeed is partly a reaction-formation
against the instinctual processes of the id [5,p.58].
Figure 1.5. is a block diagram of the psychical model as Freud has
dynamically described it in strictly a linear time invariant sense which means that
virtually none of his theories of development such as the Oedipus complex can be
represented. In fact, an attempt to do so would result in a series of models progressing
from a simplified system excluding both the super-ego and the repressive block. This
could be realized by using adaptive parameters within the model in which case, the
pre-Oedipus model would have a zero gain for the super-ego and would directly
transmit all signals from the id to the ego yielding no repression at all.
Finally, an interesting, but not unexpected, result of modeling the system in this
manner is the ability to see how Freudian slips might occur. The emotional outputs, Ze
consciously and Zi and Zs unconsciously, drive thoughts and motor responses. By
referring back to the anatomy of the brain and knowing that all information is processed
through the limbic system, and if all of Freuds emotional elements exists
somewhere in the limbic system and reptilian brain, then the outputs Zi and Zs can
indeed influence the accidental execution of emotions through words and actions.

External Environment
1.5. The Complete System.
The Mathematical Models
Sigmund Freud knew nothing of control theory. He was, however, exposed to
the mathematical concepts governing mechanical systems as evidenced by his continual
reference to dynamics in the psychical model. The block diagram in figure 1.5. can be
written as mathematical expressions. In this case, all the inputs can be considered
commands in which the all outputs are determined by the dynamics of the
corresponding components. To this point, Freud never indicates one element responds
to the rates of emotional change of another. Mathematically, this eliminates rates or
accelerations along the command chain. Therefore displacements are used to
communicate between the ego, id and super-ego. This is best seen by examining the
block diagram of a single component. Figure 1.6. is the block diagram for the ego.
The super-ego and id can be built in the same manner.

b2s2+bjS + b0 b2s2+bjS + b0
3 s + ajS + a0 2 s + 3jS + a0
- Ze
1.6. Block Diagram of the Ego.
The approach taken is quite classical and involved modeling the dynamics for
each subsystem as a mass-spring-damper. In this way it is easy to visualize the effects
on displacement any force can cause. Imagine a block of wood resting on a slinky.
This system remains motionless until I reach down and apply a force on the mass. The
system will respond with increased resistance to my force proportional to the distance
the spring is compressed. This characteristic is parametrized by the value of Ke, the
spring stiffness constant. If I were to release the pressure and let the system move
freely, it would recoil upward, then downward, back and fortlroscillating until it once
again came to rest at its initial position before I influenced it. The factor that determines
the amount overshoot that will occur while the mass is seeking its steady state resting
position. This characteristic is known as positive damping and is parametrized by the
variable, Be. The damping is based on the rate of movement of the block of wood.
Finally, if the stiffness, Ke were divided by the mass of the wood (Me), the result
would be the frequency of which the block will oscillate. These are what define the
dynamics of the system. Thus, knowing Ke, Be and Me enables the system to be
completely mathematically modeled in a linear sense. Prior knowledge of these
parameters allows one to predict exactly the physical response of the system with
respect to the amount of force applied and the initial conditions of the system. Equation
1.1. is the mathematical expression in the dynamic time domain. This is expressed

in the frequency domain by taking the Laplace transform (and assuming a
homogeneous system). Equation 1.2. is the state space representation of the same
system. From this point on, this will be the manner of mathematical expression.
This mass-spring-damper system is analogous to each of Freuds components.
If the block of wood represented a certain amount of mass associated with the ego, for
example, then the forces that would be applied to it would originate from the perceptive
conscious, super-ego and id (via the preconscious). But regardless of the true nature of
the forces, whether or not they are impulses or sinusoids, the mass of the ego would
move in a predictable manner based upon the equivalent parameters Be and Ke of the
Now imagine that the damping of the ego was actually negative. This would
mean that as I applied a force and then released it, instead of bouncing back and forth
until it came to rest, it would literally increase the amount of overshoot and eventually
bounce off the face of the earth. In control theory, this is an unstable system. Without
even referring to what Freud might have to say about this, intuitively it makes sense
that we can emotionally be unstable. We all know people we would describe as
egotistical or worse egomaniacs. This introduces the concept of stability and leads to
the question: What is responsible for maintaining emotional stability within us? Well,
+ kez(t) = Ku(t) (1.1)
z(s)=[ 1 0] H +[0]U(S)

Freud does indeed ask the same question and it is covered in Chapter 2. For now let it
suffice to say that something controls our emotions. The compensated system
contains the same plant as well as a compensator in the forward path and uses unity
feedback. Refer to Appendix A for the development of the isolated system. These
equations are specifically for the ego, but reflect the id and super-ego structures as well.
Equation 1.2. is altered as follows.
(aii-i) ai2 ai3 ai4 b4 twKs t*Kr
1 0 0 0 X + b3 b3Ks b3Kr
0 1 0 0 b2 b2Ks b2Kr
0 0 1 0 _bl biKs blKr
0 0 0 ]x
This controller or compensator can be set up in such a way as to force two
things to happen. First, in steady state conditions (at rest after oscillating) the output
displacement can be made to exactly match the input command. If it is commanded to
move three centimeters down, it will be three centimeters down when it finally settles to
rest. Secondly, while it is settling, the time it takes to do so and the amount of
overshoot it will incur can to limited. This allows for control over how quickly it will
reach steady state. All this is based on feeding back the position and letting the
compensator work to bring the error between the commanded and actual positions to
zero. The compensator for the ego is systematically shown in figure 1.6. and is labeled
G. This scheme is used for the ego, id and super-ego.
The repressive mechanism is modeled using a simple low pass filter. This will
allow low frequencies to pass through while repressing any high frequency signals.
What this means physically to the mass-spring-damper system set up for the id is that
as the id oscillates at frequencies lower than the cut-off frequency, these movements
will be transmitted back to the ego mass-spring-damper through the repressive filter

(i.e., not repressed). Therefore any oscillation above the cut-off will not be sensed by
the ego. In a more realistic model, this piece would be better if it rejected ranges of
frequencies and included nonlinearities for thresholds.
The complete systematic block diagram is given in figure 1.7. Each element
consists of a plant and compensator pair like that just discussed. An important
feature is the sign convention of the summers. The signal along the command path
always are assigned positively. The two signals fed back to the ego are subtracted
away from the environmental input This is to facilitate Freuds reality testing of the
ego. The signal output of the summing junction is the difference between reality and
instinctual commands. Interestingly enough, if these signs are positive, the error is
propagated and the system is unstable.
The coupled system equations are given below. They are expressed in a
nonstandard state space form for clarity. They are written in a partitioned form so that
the dynamics in the A matrix can be easily seen for each component of the system. The
K matrix is the coupling matrix. The elements of this matrix in the upper triangular are
the feedback gains and the elements in the lower triangular are the feed forward gains.
By solving the equation 1.4. for the vector Z, and then substituting this into the first
dynamic equation, the system can be solved for the standard A,B,C, and D matrices of
the coupled system. This is in fact the method used for the simulations to follow.
Refer to Appendix B for the complete derivation.

Internal Instincts
1.7. Block Diagram of the Complete Psychical Model.
AeO 0 (T Be 0 0 (T
0 Ai 0 0 0 Bi 0 0
X = 0 0 As 0 X + 0 0 Bs 0
0 0 0 Ar 0 0 0 Br
Ce 0 0 (f De 0 0 0~
0 Ci 0 0 0 Di 0 0
z = 0 0 Cs 0 X + 0 0 Ds 0
0 0 0 Cr 0 0 0 Dr
Del 0 0 Kse KeT Ze"
Ui Kei 0 0 0 Zi
Us + 0 Kis 0 0 Zs
Ur 0 Kir 0 0 Zr
Tie 0 0 Kse Kei "Ze
Ui Kei 0 0 0 Zi
Us + 0 Kis 0 0 Zs
Ur 0 Kir 0 0 Zr


The Libido and Object Cathesis
From observation Sigmund Freud developed concepts as to how the basic
components of the ego, id and super-ego convey both thoughts and feelings between
themselves. This introduces the notion of separating objects from emotions and the
principles of libido and object cathesis.
An object can be anything such as an idea, a thing or a person. In a cognitive
sense, this could be anything of which one is aware. In the purest psychoanalytic
interpretation an object is a person, a part of a person, or a symbol representative of
either, toward which behaviors, thoughts and desires are oriented [12). Emotions, on
the other hand, really have no exact definition other than what may be implied through
the context in which it is discussed. For purposes here, emotions will be anything
which at its most rudimentary level is a function of life and death instincts. For
example, Freud attributes aggressive behavior to self preservation and thus the death
Originally Freud defined libido as the mental energy which, being derived from
the id, is fundamentally sexual. Later he modified his definition to be less sexual and
more closer related to the life force [12]. The key phrases in this definition are mental
energy and derived from the id. He theorizes that a source of energy exists within

the mind that originates from the the id and is taken by the other two components, the
ego and the super-ego. Object cathesis is then, the investment of this libidinal energy in
an object [12].
The manner in which this all flows together is fundamental in the
communicative processes that take place within the psyche. And, in fact, it is from
these concepts that the reality and pleasure principles can be incorporated into the spatial
model of which Freud proposed. From his clinical observations and studies of
repression he concluded that feelings are directly transmitted from the unconscious to
the conscious as if there were no preconscious state. In other words, non-repressed
feelings from the id are directly transmitted to the ego. Meanwhile, in a completely
dissimilar fashion, ideas from the unconscious need connecting links, objects, to allow
them to be perceived in the conscious.
The incorporation of logic in the model becomes possible enabling Freud to
make conclusions such as, The super-ego does not specifically tell the ego what to
think, just how to feel with respect to certain objects [5]. This personification implies
logic through the word think and emotion with the word feel. If it is indeed the
case that the logic of the unconscious super-ego is associative and the logic of the
conscious ego is rule based inference then it makes sense that how to think about an
object is not communicated, it does not need to be because logic is present in both
elements. However, feelings relating to an object do. Remember, the ego is constantly
being influenced by three sources. The emotions it assigns to an object are perceived
either from the id via the preconscious or from external stimuli. On the other hand, the
emotions assigned by the super-ego are self generated. The difference between them is
the basis of reality testing and the reason behind some forms of anxiety such as guilt.

The Pleasure Principle and the Reality Principle
Sensations of a pleasurable nature have not anything inherently
impelling about them, whereas unpleasurable ones have it in the highest
degree. The latter impel towards change, towards discharge, and that is
why we interpret unpleasure as implying a heightening and pleasure as a
lowering of energetic cathesis [5,p.l5].
Having incorporated energy into his model through libido and object cathesis,
Freud expands the notion to include principles concerned with the quantity and change
of quantity of energy present. The pleasure principle is the pleasure-seeking, pain-
avoiding operations of the unconscious [12], What is felt as pleasurable is any
emotion that decreases the level of energy and oppositely any feelings that increase the
energy are felt as unpleasurable. The id obeys the pleasure principle almost exclusively
trying to respond mostly to the life instincts, but the entire psychical apparatus strives to
keep the level of energy present as low as possible. The relationship of
pleasure/unpleasure to the level of energy is not a simple proportionality. Freud relates
the feelings more to the changes in energy level.
We have decided to relate pleasure and unpleasure to the quantity
of excitation that is present in the mind but is not in any way 'bound'...
What we are implying is not a simple relation between strength of the
feelings of pleasure and unpleasure and the coiTesponding modifications
in the quantity of excitation; least of all in view of all we have been
taught by psycho-physiology are we suggesting any directly
proportional ratio: the factor that determines the feelings is probably the
amount of increase or diminution in the quantity of excitation in a given
period of time [4,p.4].
In conflict, the reality principle is the awareness and recognition of the real
environment that the ego has and its demands and the need to accommodate them,
regardless of whether it is pleasurable or not [12]. Simply put, the ego imposes the
truth as it perceives it to be upon the id.

The Tendency Towards Stability
A contemporary of Sigmund Freuds named G.T. Fechner identified the
limitations inherent to the pleasure principle. He stated that pleasure and unpleasure
have a psycho-physical relation to stability and instability with stability being
characterized by a lack of excessive emotional change. Freud incorporated Fechners
principle and wrote of thresholds and regions of instability. Figure 2.1 illustrates the
limitations of pleasure/unpleasure that bound our abilities to remain stable. Remember,
it is the change of energy that is significant.
[E]very psycho-physical motion rising above the threshold of
consciousness is attended by pleasure in proportion as, beyond a certain
limit, it approximates complete stability, and is attended by unpleasure in
proportion as, beyond a certain limit, it deviates from complete stability;
while between the two limits, which may be described as qualitative
thresholds of pleasure and unpleasure, there is a certain margin of
aesthetic [perceptual] indifference [4,p.5].
2.1. Illustration of the Pleasure Principle and Region of Stability

The Mathematical Representation
In Freuds mechanized model emotional displacements are all that is needed in a
dynamical sense. But this is limited. In the analogous mass-spring-damper system this
corresponds with positions of the ego, id and super-ego after settling down to their
steady state positions. This literally means that all the energy present which determines
the emotional state of being is potential since the kinetic energy is zero. If this were the
case there really are no dynamics present, this would be a static model. When Freud
accounts for libido and object cathesis and wraps the pleasure principle and reality
principle around all of it, he forces the model into a truly dynamic situation. These
concepts are not only based on the energy available, but also on the change in energy
and the manner in which it occurs. Mathematically, the challenge is to represent all
these concepts within a uniform structure. By making the assumption that 1) all objects
have a signature set of frequencies and 2) that all emotions operate within preselected
frequency ranges, this can actually be done through the use of amplitude modulation.
Examine the mass-spring-damper once again. If the force acting upon it moves
in a sinusoidal fashion, the block of wood will also move as a sinusoid. Exactly how,
is of course determined by the parameters of mass, spring stiffness and damping. Let
the sinusoid contain specific frequencies characterizing one unique input, the object
signature set, and let every person in the world be an object having their own way of
pushing on the block. By measuring the movement of the block of wood anyone
could tell just who pushed it, so long as they knew every person in the worlds pattern.
Unfortunately, in the time domain it is difficult to tell what frequencies are present
making the job more difficult as seen in the top plot of figure 2.2. However, if you
wisely took the Fourier transform of the response, and then examined the energy
spectrum or the power spectral density, PSD, then the task would be almost trivial, as

in the bottom plot of figure 2.2. For reference, the equations for doing this are listed
below. Parsevals theorem is also given to emphasize the relationship between the time
domain and the frequency domain. This allows for a complete understanding of the
For all the examples to follow, the power spectral density was calculated based
on the expected value of the product of the Fourier transform times its complex
conjugate. In the time response it is difficult to tell that there are three distinct
frequencies present. However, by examining the power spectral density of the signal
not only which frequencies are present but the amount that each contributed to the input
on the block of wood is known. The area under each of the spikes indicates the amount
of power (energy) associated with those frequencies. This is how libido of a
component can be represented and monitored based on the previously mentioned
Fourier Transform
Energy Spectral Density E(w) |X(w)p
Power Spectral Density PSD = E[ X(w)X*(w)]
Parseval's Theorem
E(w) = I |x(t)|2 dt I |X(w)p dw

Object Signal
2Q xl05____________PSD Signature of Object

0 100 200 300 400 500
2.2. Time Response and Corresponding PSD.
Object cathesis is achieved using the principle of amplitude modulation. The
method is simple, multiply the signal containing the information by one or more carrier
signals, the result is an amplitude modulated signal that carries the information in bands
associated with the carrier frequencies. Figure 2.3 shows how this is done with two
carrier wave frequencies.
A cos(Wa t)
Carrier Waves)
B cos(Wb t)

2.3. The Principle of Amplitude Modulation.

In the mass-spring-damper analogy there is no difference mechanically. The
block of wood will still respond in a predictable manner and the output is still a
sinusoid. The only important difference is the amount of information extracted from a
PSD is considerably more. The specific object signature is still available but now exists
in two separate frequency ranges. Referring back to the mass-spring-damper example,
this equates with saying that as someone pushed on the block of wood, they had the
skill required to do so in a modulated sense where the carrier wave now represents the
emotions behind the person applying the force. This may be unbelievable in the
mechanical world of springs and masses, but in the signal processing world, this is
common. After all we are ultimately solving a signal processing problem. Figure 2.4.a
is the object signature, and figure 2.4.b is the modulated signal. As is seen, the
frequencies of the object sinusoid are reflected symmetrically about the carrier wave
frequencies of 100 and 400 Hz.
PSD Signature of Object
2.4.a. The Object Signature.

Modulated Environmental Signal to the Ego
x!Q4 PSD of Environmental Signal to the Ego
1 J : i ft... i
1 llJl i i Itk r_
0I---------------------:----------:-----' *-----
0 100 200 300 400 500
Frequency (Hz)
2.4.b. The Emotionally Modulated Object Signature.
With all the pieces in place, the complete system can be assembled. The block
diagram derived in Chapter 1 is still valid, all that has been affected is the nature of the
signals applied to the inputs. These signals now contain information identifying the
object(s) and the emotions associated with them. (Keep in mind the definition of
emotions as previously stated.) The instinctual inputs are now modulated emotionally
with frequency ranges that represent life and death impulses. The input into the ego
contains the same emotional modulation as the instincts for purposes of clarity, but it is
not necessary.
In fact, it is appropriate here to discuss the differences of origins of the
emotional modulation between the ego input and the instinctual inputs. Because of the
nature of the ego which operates in a more cognitive manner than the id or super-ego, it
would seem that the emotional modulation to the ego is a function of what is
comprehended in the conscious mind. If the object was someones spouse with a
frying pan in hand, the ego input might perceive as reality that they are being somewhat

aggressive. The instinctual inputs actually make sense without any justification since
they are modulated with life and death impulses. Figure 2.5 shows the inputs now
modulated by emotions.
2.5. The Block Diagram with Emotionally Modulated Inputs.
The pleasure principle is easily observed now that the information is represented
with power spectral densities. Given the conditions below, the pleasure principle can
be restated with equation 2.6. If the change of energy increases, the emotion
experienced is unpleasurable. Likewise and decrease of energy is felt as pleasure.
Given, E is the quantity of excitation, a measurable amount related to a feeling, and F is
either a pleasurable or unpleasurable feeling, then equation 2.6 describes the pleasure
principle mathematically.
IFI = k(dE/dt) = pleasure, if dE/dt > 0, or
unpleasure, if dE/dt < 0. (2.6)

The pleasure principle is demonstrated in the series of plots in figures 2.6.a to
2.6. c. The output of the id is represented in figure 2.6.a. The object signals and the
modulating signals are the same as presented previously. Figure 2.6.b shows that the
id emphasizes the instinctual commands because the most energetic frequency range is
centered around the life instincts, Eros. The signal is then sent to the repressive
mechanism in the preconscious. This is modeled with a simple low pass filter with a
cut-off frequency of 250 Hz. As expected, the output in figure 2.6.c of the repressive
filter contains virtually no energy associated with the life instincts, even though the id
stressed them. Furthermore, the total energy is less than would be if the bandwidth of
the repressive filter had been high enough to allow passage of all the instincts. Thus
the energy is reduced, demonstrating the pleasure principle. An important observation
to note relating to this example is that it was the emotion that was repressed and not the
The reality principle can be demonstrated as well using the three inputs of the
ego and the two signals input to the id. The ego receives input from external stimuli,
and two inputs from the unconscious. The id receives the output response of the ego
and an input from the instincts. Figure 2.7.a is an object modulated equally by
emotions derived from both the life and death instincts and is reality as perceived by
the ego. The first condition of the reality principle is that the ego tries to decipher what
is true separating out as best it can the signals coming from the unconscious. Figure
2.7. b is the output of the ego. The trend as set forth by reality is still present even
though the overall magnitude is lower. (This difference is caused by the subtraction of
the signals originating from the unconscious.) Figure 2.7 .c is the instinctual input into
the id. The second condition is that the reality signal be imposed on the id regardless of
the instinctual input. For this to hold true, the combined input to the id must take on
trends similar to reality, which is in fact the case as seen in figure 2.7.d.

Phase (deg) Gain (dB) Gain
Output Response of the Id
Gain of Id = 120)

Time (sec)
2 x!Q4________PSD of Output Signal from the Id

A A a!
0 100 200 300 400 500
Frequency (Hz)
2.6.a. Emotionally Modulated Output from the Id.
Frequency (R/S)
Frequency (R/S)
2.6.b. Bode Plot of the Linear Low Pass "Repressive" Filter.

PSD of Output Signal from the Rep

Lh l\~A
0 100 200 300 400 500
Frequency (Hz)
2.6.c. "Unrepressed" Output from the Preconscious.
Modulated Environmental Signal to the Ego
2.7.a. "Reality" as Perceived by the Perceptive Conscious.

0I---------------------:----------:-----1 \-----
0 100 200 300 400 500
Frequency (Hz)
2.7.b. Output from the Ego to the Id.
Modulated Instinctual Signal to the ld
0 0.05 0.1 0.15 0.2 0.25

2.7.c. Instinctual Input to the Id.

Combined Signal to the Id
2.7.d. Combined Input Command as Perceived by the Id.
The last principle is the tendency towards stability. Fechner and Freud set up
the relationship between the pleasure principle and the region of stability. Pleasure and
unpleasure are felt dependent upon the direction of change in the amount of libido and
that stability exists within a region set by upper and lower limits of that change. Each
element, the ego, id and super-ego, have portions of the energy within the complete
system. This would imply that all three have limits imposed on them, and thus each
component has the ability to make the whole system unstable.
The amount of energy in an element such as the ego is controlled by varying the
gain. In other words, increase the gain and the energy goes up. If the gain of the ego
exceeds a limit, either high or low, the ego should then go unstable forcing the entire
system into instability.
A component (i.e., the ego) is initially set up to have two features, a plant and a
compensator which are defined to have a total of two pole and zero sets. This is seen in
the root locus in figure 2.8.a. It is assumed here that the unstable complex pole and

zero are a function of the plant. This is commensurate to defining the mass-spring-
damper damping ratio to be negative allowing for the condition of an unstable plant
forcing the need for compensation.
The compensator is set up to do two things. First, and most importantly, the
compensator ensures stability exists based on some region of gain. This is the region
of stability required. Also, as the gain increases or decreases, the change of energy will
follow accordingly. This corresponds to the condition imposed by the pleasure
The compensator must also account for the steady state DC bias. This
requirement goes back to the concept of emotional displacement. In order for the ego to
effectively dictate a position to the id, there needs to be an integrator in the scheme to
drive the DC error to zero. This condition is also accounted for in the compensator
without changing its order using a pole on the origin and a real tau. The stability
margins can be seen in the open loop Bode plot in figure 2.8.b again demonstrating the
dependency of stability on the gain, and the energy available within the component is
visually given in the closed loop Bode plot in Figure 2.8.C.
-60 -40 -20 0 20 40
2.8.a. Root Locus of the Ego.

Phase (deg) Gain (dB) Phase (deg) Gain (dB)
Open Loop Bode Plot the Ego
Gain of Ego: 2( 00
Frequency (R/S)
Frequency (R/S)
2.8.b. Open Loop Bode Plot of the Ego.
Frequency (R/S)
2.8.c. Closed Loop Bode Plot of the Ego.

Simulation of the Model
The best test of any model is to run it through a simulation and see how close
the results come to the predicted behavior. This chapter is dedicated to do just that and
examining the system as a whole and defining the limits of the model. The model was
designed to incorporate everything discussed so far. This includes:
The conscious and unconscious "
The perceptive conscious, preconscious and repression
The ego, die id and the super-ego
Life and death instincts
Objects and emotions (based on instincts)
Libido and Object Cathexes
The pleasure principle
The reality principle
The tendency toward stability
All the parameters used to define the ego, id and super-ego are listed in table
3.1. The gains used in connecting the components are listed in table 3.2. and is set up
to match exactly the K matrix used in the simulation for linking the model together.
Table 3.3. lists the signal characteristics used as inputs. When reading it, the forward
path gains are located in the lower triangular of this matrix and the feedback gains in the
upper. One final note, the markers on the block diagram in figure 3.1. correspond to

figure numbers of figures 3.2.a through 3.2.h. The signals depicted in the figures are
taken from the points during the time simulation.
Table 3.1. Parameters of the Components.3
Compensation Plant Dynamics
1.0 (0.2.2401 2000 (-0.1.2001
(0.02) S (-0.1,400)
1.0 (0.2.2401 1200 (-0.1.2001
(0.02) S (-0.1,400)
1.0 (0.2.2401 12001-0.1.2001
(0.02) S (-0.1,400)
l.o (0.2001
Table 3.2. Gain Matrix K, Linking the Components.
Eg& M Super-Ego--' Renression
Ego 0 -.01 -.01
Id .001 0 0
super-ego 0 .001 0
Repression 0 .1 0
3 The system notation is as follows :
(£,co) = second order for damping and frequency,
(x) = first ordertau.

Table 3.3. Object and Emotional Signal Definitions.4
Obiect Sienal Emotional Carrier Wave
Amp Hz Amp Hz
Reality 4 5 1 100
2 20 1 400
6 35
Id Drive 2 5 .5 100
1 20 1 400
2.5 35
S_Ego Drive 2 5 1 100
1 20 .5 400
2.5 35
Figure 3.1. The Block Diagram with Emotionally Modulated Inputs with Labels
Corresponding to Figures 3.1.a Through 3.l.j.
Lets set up a scenario. The place is a dimly lit bar with lots of music and
smoke. The room is full of not quite so normal specimens of men and women
cruising. The person of this example, say Sigmund, is leaning against the bar stroking 4
4 Freud allowed for the Id and Super-Ego to be driven by elements of both life and death
instincts, but with varying emphases. This is reflected in the amplitudes of the Id and S_Ego
emotional modulators. The life and death frequencies are 400 Hz and 100 Hz respectively.

his beard, observing. Sigmund comes to this place often, not that he ever gets lucky or
even knows really why he does it, but its just a place he always winds up being.
Across the way he catches a six foot four Amazon women wearing what appears to be a
black leather breastplate, observing him. She spits a toothpick onto the sticky floor,
sets her drink on the counter and strides towards Sigmund.
So there it is, the conditions are set in which we should be able to predict
something interesting. The reality of the situation is perceived by Sigmunds ego,
having passed through his perceptive conscious. Sigmunds perceptive conscious
(under the influence) tells his ego just how it really is. Figure 3.2.a is that signal. The
object is the same as the previous example having a signature set of frequencies of 10,
20 and 40 Hz. The emotions modulating the signal are at based around frequency
ranges of 100 Hz for the death instincts and 400 Hz for the life instincts. The
perceptive conscious is modulating the object signal equally with respect to both of
Meanwhile, Sigmunds perceptive conscious is also receiving signal from his
super-ego relating to the object. These are seen in figure 3.2.b. Notice the emphasis in
the frequency range associated with deaih, 100 Hz. This is the super-ego focusing on
the object with emotions pertaining to Sigmunds feelings of self preservation. The
source of anxiety according to Freud is the difference between reality and the super-
ego. So perhaps Sigmund unconsciously picks up an olive fork, just in case.
These emotions are combined in the perceptive conscious and relayed to the
ego. Also acting on the ego are those feelings coming up from the preconscious.
These are feelings originating from the id relating to the object that are not repressed.
Figure 3.2.c. indicates a similar trend to the super-ego in that only feelings associated
with self preservation are transmitted. So, Sigmund is consciously aware that this
approaching female has caused him to be somewhat anxious. Figure 3.2.d is the

combined input into the ego, which includes all signals from the perceptive conscious
and the preconscious. The trend of equal emphasis still persists.
Modulated Environmental Signal to the Ego
x 104 PSD of Environmental Signal to the Ego
11 b 0 y d
0I----/ W'W -------:--------:---- WH/sJ \----
0 100 200 300 400 500
Frequency (Hz)
3.2.a. "Reality" as Perceived by the Perceptive Conscious.
Output Response of the Sego
Gain of Sego = 1)200
Time (sec)
2 x!Q4 PSD of Output Signal from the Sego

i j o A ^ A.
0 100 200 300 400 500
Frequency (Hz)
3.2.b. Output from the super-ego to the Ego.

PSD of Output Signal from the Rep
i.... ~1
-1a A-A
0 100 200 300 400 500
Frequency (Hz)
3.2.c. "Unrepressed" Output from the Preconscious.
Signal as Perceived by the Ego
W^\r " |
0 0.05 0.1 0.15 0.2 0.25
jqx104_______PSD of Perceived Signal to the Ego

L, lA LA aJ L_
01---------------------;----------:-----1 -------------
0 100 200 300 400 500
Frequency (Hz)
3.2.d. Combined Input Command to the Ego.

Having received the inputs, the ego responds dynamically and transmits its
interpretation on to the id. Figure 3.2.e is the output of Sigmunds ego. Notice, not
only is the life/death trend of reality still carried on, but the amplitude is very near the
same as reality. This is a demonstration once again of the reality principle. The output
of the ego and the instinctual command, figure 3.2.f, are combined and input into the
id. The instincts going into the id stress Eros and focus around 400 Hz. Reality is
being pushed on good ol Sigmunds id since the combined input maintains the reality
trend, figure 3.2.g. His id, however, operates on these and responds mostly to the
commands around 400 Hz., figure 3.2.h, exactly as expected. This demonstrates
Sigmunds primitive sexual desires pertaining to the preservation of the species. His id
is definitely ignoring reality and the warning sent out by the super-ego.
x!Q4______PSD of Output Signal from the Ego
0 100 200 300 400 500
Frequency (Hz)
3.2.e. Output Signal from the Ego to the Id.

Modulated Instinctual Signal to the Id
2 x104_________PSD of Instinctual Signal to the Id
IL...JI ...i
A^a a
0l______41_aA ./\_____:__________:_____J _____
0 100 200 300 400 500
Frequency (Hz)
3.2.f. Instinctual Input to the Id.
Combined Signal to the Id
1 r
0 0.05 0.1 0.15 0.2 0.25
3.2.g. Combined Input Command to the Id.

Finally, the output of the id is sent in two directions. The first is to the super-
ego where it is combined with instinctual commands, mostly death at 100 Hz. The
instinctual input and the combined input are in figures 3.2.i and 3.2.j, respectively.
The super-ego responds by emphasizing self preservation. Refer back to figure 3.2.c.
The second direction the id sends signal to is the repressive mechanism in the
preconscious. The repressive mechanism is again the same as in the previously used
and is a low pass filter with a cut-off frequency of 250 Hz. Refer back to figure 3.2.b
for the output response. In this case, it seems that Sigmund is repressing all his sexual
feelings for this woman. Maybe he had a bad experience one time.
Modulated Instinctual Signal to the Sego
2 x!Q4 PSD of Instinctual Signal to the Sego
I J 1 ... ' l
0_______i \aj irj \___;__________;______/\- aa__i\______
0 100 200 300 400 500
Frequency (Hz)
3.2.h. Instinctual Input to the Super-Ego.

Output Response of the Id

. Gain jof Id = 1200
Time (sec)
2 x104______PSD of Output Signal from the Id

A * A u lL
0_____A_____^_____:_______:____J \r~iv\
0 100 200 300 400 500
Frequency (Hz)
3.2.i. Output from the Id to the Super-Ego.
Combined Signal to the Sego
< 1 t j r YV
0 0.05 0.1 0.15 0.2 0.25
3.2.j. Combined Input Command to the Super-Ego.

So there it is, a model that behaves in a predictable manner and appears to
follow all the rules initially designed into it. This model could easily be expanded to
cover as many other situations as wanted. A more realistic model would incorporate
adaptive parameters to vary from moment to moment based on the situation at hand.
Also, the signals representing the object would most likely be much more complicated
to start with and something within the model would have to be able to focus the
attention on one object, as was done in this example.

Relating the Psvche to Elements of the Brain
Sigmund Freud developed a spatially dependent mechanization of the psyche to
explain the dynamics of human development and behavior. Like any scientist studying
the unknown, he based his theories on clinical observation. And like any theory, it is
held true until disproven. While some of his principles of emotional development have
been scrutinized, clinical evidence today is beginning to support some of the spatial
orientation and mechanization he accredited to the psyche. Perhaps this is because the
mind is after all constructed with the real, physically dynamic elements that make up the
Freud indicated through his writings a symbiosis exists between emotions,
logical constructs, instincts and motor discharges. For example, he described thought
processes as being represented by displacements of mental energy which are effected
somewhere in the interior of the apparatus. He also indicates that the id lies deep
within the mental apparatus and instincts originate from somewhere even deeper and
more primordial. Although Freud never actively tried to localize the psychical mind
within the physical brain, some of his descriptions come across as if he suspected
where the elements of the psyche actually reside.
No one knows what defines the conscious and the unconscious anatomically.

Maybe it is distinguishable in only in the signals transmitted through the brain.
Mathematics might yield some insight to determine this. But the attributes Freud
assigns to the conscious and unconscious can to a small degree be localized. He
expresses this as follows.
What consciousness yields consists essentially of perceptions of
excitations coming from the external world and of feelings of pleasure
and unpleasure which can only arise from within the mental apparatus; it
is therefore possible to assign to the system Pcpt-Cs a position in space.
It must lie on the borderline between outside and inside; it must be
turned towards the external world and must envelop the other psychical
systems. It will be seen that there is nothing daringly new in these
assumptions; we have merely adopted the views on localization held by
cerebral anatomy, which locates the 'seat' of consciousness in the
cerebral cortex the outermost, enveloping layer of the central organ
The cortex indeed displays functions similar to those Freud assigned the
perceptive conscious, the conscious, the ego and the preconscious. Anatomically, there
are four lobes of the cortex. The parietal, occipital and temporal lobes process the
information regarding the physical body representation and sensors, the visual center,
and hearing and perception, respectively. These functions correlate well with the
perceptive conscious. Further along these lines, if the conscious and ego related best to
a single element, it would most likely be the frontal lobe of which it has been
determined is the mechanism attributed to planning, decision making and purposeful
Figure 4.1 illustrates the spatial orientation of the lobes of the cortex. From the
outer surface in, the functions of the lobes correspond well with Freuds model. The
perceptive regions lie farthest from the brain center and the preconscious regions of
the temporal lobe lie nearest the center. Referring back to figure 1.1, Freud depicts in
his sketch of the conscious, a cap of hearing, the acoustical perceptions that relate

directly with the preconscious memory traces. The temporal lobe combines hearing
and perception with memory. Furthermore, it literally connects with the emotional
inner world of the limbic system, just as the preconscious attaches to the id.
All memory processing requires the use of the hippocampus and amygdala, two
important elements in the limbic system. The hippocampus is an ancient structure
within the brain that links the limbic system with the multisensory inputs of touch,
vision, sound and smell. It is instrumental in the formulation of spatial memories and
simple recall. The amygdala, also a part of this linkage, is fundamental in
rearrangement of memory images and the formulation of emotional memories. There
is a powerful link between emotions and memory. Memories are stronger and more
enduring when associated with emotions.5 Perhaps here in lies the source of many of
Freuds concepts such as repression (preconscious) and transference (associative
logic). The limbic system is illustrated in figure 4.2.
5 It is possible that these relationships between spatial and emotional memories
is indicative of some form of signal modulation.

There are two clues as to where to locate the id, one of the two members of the
unconscious. The first comes from its proximity to the preconscious and instinctual
drives, between which, Freud spatially orients it. The second comes from Freuds
belief that the id is directly influenced by the pleasure principle. So finding the source
of sexual drive and the pleasure and pain centers of the brain is important.
A good candidate for imitating id-like functions comes from the hypothalamus
and pituitary gland, two more structures within the limbic system. Among their many
jobs they regulate the hormones directly associated with reproduction and sexuality.
Whether this would be an input or an output of the id is very uncertain, remember the
brain functions are highly coupled, especially at this anatomical level. But for certain,
something relating the sexual instincts to emotional behavior is found within these
elements. Other evidence indicating the hypothalamus is the pleasure center and its
possible correlation to the pleasure principle.6 The pleasure center is located (in loose
terms) in the lateral portions of the hypothalamus.
The super-ego is as impossible to locate as the id. However, aggression is one
of the strong motivational states originating in the hypothalamus. The death instincts
are often though of as related to aggressive behavior. Similarly, the punishment
center is located in the midline of the hypothalamus, another characteristic Freud
attributes to the super-ego. Again, whether these are inputs or outputs to what Freud
called the super-ego is uncertain. The super-ego falls within the same highly coupled
world as the id.
The most primitive part of the brain is the reptilian brain which is merely the
brain stem. This reflects our ancestral relationship to reptiles and within this brain are
the mechanisms for self-preservation and the preservation of species [13]. These two
functions behave very much like those of the life and death instincts and do indeed exist
within the deepest strata of the mind. The brain stem determines the level of alertness
This suggests that through this physical mechanism, the energy present (in the
entire brain?) can be reduced.

as a basic survival mechanism and stresses important information.
4.2. The Limbic System.
At this time, something else needs to be discussed; the topic of rhythms and
how they really relate to Freuds model. The mathematical version presented here most
definitely depends upon understanding the frequencies present. This notion is
supported biologically as evidenced in man himself. Humans as organisms are driven
by rhythms, either externally imposed or internally derived. From the cycles of the
seasons to the regular periods of night and day, external stimuli triggers within us
electrochemical changes that affect our behavior. Biologically, we have internal clocks
that regulate everything from body weight to sexuality. There are several natural
oscillators at work inside us, the master of which is the hypothalamus.
Like a symphony, all the periodic structures within our brains must operate in a
harmonic fashion. The reproductive organs in humans function properly only with the
combined rhythmic interactions of the hypothalamus and pituitary gland. Neurons, the

basic construct of the brain, are frequency dependent. Information is not transmitted
based on the amplitude of the dendrite potentiation, the neural receptor, but is
transferred based on the frequency of the pulses.
One scientist has developed a unique theory connecting memory processing,
theta rhythms, REM sleep and Freudian psychology. He is Jonathan Winson from
Rockefeller University, a specialist in memory processing in waking and sleeping
states. He addresses the issue of the purpose of dreams, something about which Freud
spent a great deal of time theorizing. Winson [15] states that the act of dreaming is a
reflection of an individuals strategies for survival. That during REM sleep, the theta
rhythms in humans reinforce learning. He bases this on studies of long-term
potentiation of the dendrites where neurons undergo permanent change if excited during
the peak of the theta wave, the source of which is the hippocampus. In humans theta
wave is only present during states of REM sleep and hypnogogia.
Winson concludes that Freud set forth a profound truth in his work when he
professed that dreaming was the royal road to understanding the unconscious. Where
he differs from Freud is in the reasons dreams are so important. He writes, Rather
than being a cauldron of untamed passions and destructive wishes, I propose that the
unconscious is a cohesive, continually active mental structure that takes note of lifes
experiences and reacts according to its own scheme of interpretations [15,p.96].

The model presented here has one inherent problem, it is linear and time-
invariant. Any realistic model of the human psyche or brain would be nonlinear, time
varying and most certainly, adaptive. If this were the case, some of Sigmund Freuds
principles could have been better represented. The pleasure and reality principles
would function better if given cognitive methods of adaptation. Other concepts were
completely unaccounted for here because of the model restrictions. One example is the
transference of libido from one component to another. This was considered
fundamental to Sigmund Freuds explanations of the emotional volleying that occurs.
Two specific items that would benefit from an adaptive system are the coupling
terms and the dynamic parameters. The gains linking the components together should
continually adjust, based on the dynamics of the situation. The parameters of the
components, e.g., the spring stiffnesses, etc., should adjust as well, but with a slower
What was successful was the mathematical representation of Sigmund Freuds
spatial model for the psyche and some of the basic principles governing their dynamics.
This was accomplished principally by introducing three things to Freuds model. The
first, putting everything into the frequency domain; second, evaluating energy content

through power spectral densities; and third, by modulating the object signals with
emotions. Whether the mathematical model exactly interprets Freudian psychology is
not so much the issue, what it points out is that a connection can be made relating
mathematics and human behavior.
Furthermore, by modeling the ego, id and super-ego mathematically a model of
the structures of the brain and their interactions is also being modeled, indirectly.
Connections where established along these lines between Freuds conceptual model and
the functions of the brain. Finally, this connection is very visible through studies
performed by people such as Jonathan Winson [15] where he has observed the links
first hand.
One conclusion that should be drawn from this thesis is that there is indubitably
a set of equations that describe both the physical and psychological principles that
govern the behavior of man.
Recommendations for Further Research
Model of brain structures and functions have been done in the past. The rule
based, probabilistic approach of artificial intelligence attempts to imitate the functions of
the frontal lobe of the cortex. CMAC, is a neural net capable of coordinating
movements in robotics, is a model of the cerebellum. Neural net technology can
perform visual and audio pattern recognition and can use algorithms to learn, based
on fuzzy logic: all cortical functions. But, until now there has been only one attempt to
model emotions. This comes from a joint effort between Boston University and
Massachusetts Institute of Technology on a project called Mobile Adaptive Visual
Navigator, MAVIN.
MAVIN is a semiautonomous robot with an advanced neural design that

performs all the functions mentioned above. One of its peculiarities to the world of
robotics is its incorporation of emotion into the neural design. It learns using self-
organizing, teacher controlled, reinforced algorithms which integrate these and
combines them with external stimuli and internal emotional states (i.e., fear, relief,
sadness, etc.). MAVIN even has what is referred to as conscious and unconscious
One of the inconsistencies of MAVINs design is that it models emotions in a
human-like fashion without considering their sources. Emotions of fear, relief and
sadness are higher level states that derive from the conflict between reality and primitive
level instincts. Thus MAVINs architecture is based on something far less than human.
This approach, lends itself to the classical problem experienced by of both artificial
intelligence algorithms and neural networks in that it requires virtually one node per
object, such as a fear or sad node. If in the human brain this were the case, our heads
would be huge. Perhaps, a design incorporating all the sophistication of MAVIN and
the rudimentary functions of the limbic system may yield an even better adaptive
prototype. Call it MAHVIN for Mobile Adaptive Human-like Visual Navigator. (Just
a suggestion of course.)
To date, no one has tried to model the brain based on the systematic functions of
the brain structures. This would in fact be the best approach because it lends itself to
system identification through actual laboratory measurements. Possible future benefits
of systems derived through this approach are exciting. MAVIN technology would
become HAL technology (2001 A Space Odyssey). Models of mental diseases such
as schizophrenia could be built and customized for real people. Maybe, even farther
into the future, the effects of drugs on behavior could be done at a terminal speeding up
the process of investigation. The potential uses of such technology would be limitless.

1. Dayhoff,J. Neural Network Architectures: An Introduction. New York:
Van Nostrand Reinhold, 1990.
2. Fermelia, A., Foster, J.E. "Mechanical Vibrations, Chapter 4,"
Manuscript in preparation for publication,1990.
3. Fermelia, A., "Application of CLM to Design Feeling State Sensors,"
Proposal to the National Institute of Health, submitted December 1990.
4. Freud, Sigmund. Beyond the Pleasure Principle. Trans. Peter Gay.
New York, London: W.W. Norton and Company, 1961.
5. Freud, Sigmund. The Ego and the Id. Trans. Peter Gay. New York,
London: W.W. Norton and Company, 1960.
6. Freud, Sigmund. The Freud Reader. First Edition. New York, London:
W.W. Norton and Company, 1989.
7. Kuo, Benjamin C. Automatic Control Systems. Fourth Edition. Englewood
Cliffs: Prentice-Hall, Inc., 1982.
8. Maren,A., Harston,C., Pap,R. Handbook of Neural Computing
Applications. New York: Academic Press, Inc., 1990.
9. Ogata, Katsuhiko. Modem Control Engineering. Second Edition. Englewood
Cliffs: Prentice-Hall, Inc., 1990.
10. Oppenheim, Alan, Willsky, Alan, Young, Ian. Signals and
Systems. Englewood Cliffs: Prentice-Hall, Inc., 1983.
11. Omstein, Robert, Thompson, Richard. The Amazing Brain. Boston:
Houghton Mifflin Company, 1986.
12. Reber, Arthur S. The Penguin Dictionary of Psychology. New York:
Viking Penguin Inc. 1985.
13. Restak, Richard M. The Brain. New York: Bantam Books, 1984.

14. Torrey, E. Fuller. Surviving Schizophrenia: A Family Manual. New York:
Harper & Row, Publishers, 1988.
15. Winson, Jonathan. "The Meaning of Dreams." Scientific American,
November 1990, pp. 86 96.

Appendix A
b2s2+bjS + b0 b^2+ bjS + b0
s2+ ajS + a0 s2+ a,s + a0
Figure A. 1. Block Diagram of the Ego.
- Ze
This block diagram is of the ego, but is typical of any subsystem. The state
equations can be derived in three simple steps. The first is to describe the system from
U to Ze.
an ai2 ai3 ai4 b4
1 0 0 0 X + b3
0 1 0 0 b2
0 0 1 0 _bi_
Ze = [HO l]X
Substituting Eq. 2 into Eq. 1 and reducing the system yields,
(ail -1) ai2 ai3 ai4 b4
1 0 0 0 b3
0 10 0 X + b2
0 0 10 _bi_
= [oo 0 l]x
Ze (1)

Including all the inputs for U results in the final state equations.
(ail 1) ai2 ai3 ai4
1 1 0 0 0
X = 0 1 0 0
0 0 1 0
Ze = [o 0 0 ]x
b4 b4Ks b4Kr
b3 b3Ks b3Kr
b2 b2Ks b2Kr
bi biKs biKr
These results are slightly different than those used in the complete system solely
on the inclusion of the connecting links between the subsystems, i.e. Ks. For the
complete system, the K-matrix was used instead. See Appendix B.

Appendix B
Figure B.l. Block Diagram of Complete Coupled System.
Figure B.l. is the block diagram for the complete system. It illustrates the
interconnections using the appropriate gain blocks, Kse, Kei, etc. Equations 1 and 2
describe this system in an descriptive state space form using matrix partitioning. This
system is reduced to a normal coupled state system as follows:
X = AX + B (U + KZ) (1)
Z = CX + D (U + KZ) (2)

Ae 0 0 0 Be 0 0 0 0 0 csekre
0 Ai 0 0 B = 0 Bi 0 0 K = kei 0 0 0
0 0 As 0 0 0 Bs 0 0 kis 0 0
0 0 0 Ar_ L 0 0 0 Br_ _ 0 kir 0 0_
~Ce 0 0 0 ~ ~De 0 0 0 ~zT ~u7
0 Ci 0 0 D = 0 Di 0 0 Z = Zi U _ Ui
0 0 Cs 0 0 0 Ds 0 Zs Us
0 0 0 Cr 0 0 0 Dr Zr Ur
Solving equation 2 for Z,
(I DK) Z = CX + DU
Z = (I DK)_1CX + (I DK)_1DU
Define E = (I-DK)"1 yields
Z = ECX + EDU (5)
Substituting equation 5 into equation 1,
X = AX + B(U + K(ECX + EDU))
X = (A + BKEC)X + B(I + KED)U (6)
which reduces to the standard form of
X = A X + B U (7)
Z = C X + D U (8)

Appendix C
Code for Personality Parameters
Parameters for an Individual
Ge = 2000.0
zen = -.l;
wen = 200.0
zed = -.l;
wed = 400.0
zne = 0.2;
wne = 240.0
tde = 0.02;
% Gain of the Ego
% Damping of the Ego num
% Natural freq of the Ego num
% Damping of the Ego den
% Natural freq of the Ego den
% Damping of Ego comp, num
% Freq of Ego comp, num
% Tau of Ego comp, den
Gi = 1200.0;
zin = -.1;
win = 200.0;
zid = -.1;
wid = 400.0;
zni = 0.2;
wni = 240.0;
tdi = 0.02;
% Gain of the Id
% Damping of the Id num
% Natural freq of the Id num
% Damping of the Id den
% Natural freq of the Id den
% Damping of Id comp, num
% Freq of Id comp, num
% Tau of Id comp, den
Gs = 1200.0
zsn = -.1;
wsn = 200.0
zsd = -.l;
wsd = 400.0
zns = 0.2;
wns = 240.0
tds = 0.02;
% Gain of the Sego
% Damping of the Sego num
% Natural freq of the Sego num
% Damping of the Sego den
% Natural freq of the Sego den
% Damping of Sego comp, num
% Freq of Sego comp, num
% Tau of Sego comp, den

Gr = 1; % Repressive gain
znr = [ 0 ];
wnr = [ 20000];
zdr = [ 1.0 ];
wdr= [ 1000];
kse = -.01
kre = -.01
kei = .001
kis = .001
kir = .1;
% Gains for buildsyst
NEol = Ge*conv([ 1/wen/wen 2*zen/wen l],[l/wne/wne 2*zne/wne
DEol = conv([l/wed/wed 2*zed/wed l],[tde 1 0]);
NIol = Gi*conv([l/win/win 2*zin/win l],[l/wni/wni 2*zni/wni 1]);
DIol conv([l/wid/wid 2*zid/wid l],[tdi 1 0]);
NSol = Gs*conv([l/wsn/wsn 2*zsn/wsn l],[l/wns/wns 2*zns/wns
DSol = conv([l/wsd/wsd 2*zsd/wsd l],[tds 1 0]);
Nrep = [1];
fori = l:l:max(size(wnr));
Nrep = conv([l/wnr(i)A2 2*znr(i)/wnr(i) l],Nrep);
Drep = [1];
for i = l:l:max(size(wdr)),
Drep = conv([l/wdr(i)A2 2*zdr(i)/wdr(i) l],Drep);
Nrep = Gr*Nrep;
Code for the Subsystem Time Response Parameters
T = [0:.001:.25]; % time vector
npts = 256; % no of freqs for FFT
Upcar = [ 1 100; % Pcpt_CS input into the Ego
Upobj = [4 5;
2 20;
6 35];
Uicar = [.5 100;
% Id Instinctual Inputs

Uiobj = [2 5;
1 20;
2.5 35];
Uscar = [1 100; % Sego Instinctual Inputs
.5 400;];
Usobj = [2 5;
1 20;
2.5 35];
Code for the Psychical Model
Code connects all the subsystems into one system with 4 inputs and 4 outputs
[Ae,Be,CeJ)e] = tf2ss(NEol,DEol);
[ Ae,Be,Ce,De] =feedback(Ae,Be,Ce,De, [0], [0], [0], [ 1 ]);
[Ai,Bi,Ci,Di] = tf2ss(NIol,DIol);
[As,Bs,Cs,Ds] = tf2ss(NSol,DSol);
[Ar,Br,Cr,Dr] = tf2ss(Nrep,Drep);
[se,se]=size(Ae); [re,ce]=size(Pe);
[si,si]=size(Ai); [ri,ci]=size(Di);
[ss,ss]=size(As); [rs,cs]=size(Ds);
[sr,sr]=size(Ar); [rr,cr]=size(Dr);
A = [Ae zeros(se,si) zeros(se,ss) zeros(se,sr);
zeros(si,se) Ai zeros(si,ss) zeros(si,sr);
zeros(ss,se) zeros(ss,si) As zeros(ss,sr);
zeros(sr,se) zeros(sr,si) zeros( Ar];
B = [Be zeros(se,ci) zeros(se.cs) zeros(se,cr);
zeros(si,ce) Bi zeros(si,cs) zeros(;
zeros(ss,ce) zeros(ss,ci) Bs zeros(ss,cr);
zeros(sr,ce) zeros(sr,ci) zeros(sr,cs) Br];
C = [Ce zeros(re,si) zeros(re,ss) zeros(re,sr);
zeros(ri,se) Ci zeros(ri,ss) zeros(ri,sr);
zeros(rs,se) zeros(rs,si) Cs zeros(rs,sr);
zeros(rr,se) zeros(rr,si) zeros(rr,ss) Cr];

D = [De zeros(re,ci) zeros(re,cs) zeros(re,cr);
zeros(ri,ce) Di zeros(ri,cs) zeros(ri,cr);
zeros(rs,ce) zeros(rs,ci) Ds zeros(rs,cr);
zeros(rr,ce) zeros(rr,ci) zeros(rr,cs) Dr];
K = [ 0 0 kse kre;
kei 0 0 0 ;
0 kis 0 0 ;
0 kir 0 0 ];
E = inv( eye(D) D*K);
D = E*D;
C p*p.
B = B + B*K*D;
A = A + B*K*C;
Code for Frequency Domain Simulations
MATLAB code for the freq response menu for the subsystem
psychical models
k_fds = -l;
while k_fds == -1,
k_fds = menu(['Freq Domain Studies',Name,'s ',modl],...
'Open Loop Bode Plots',...
'Closed Loop Bode Plots',...
'Root Locus');
if k_fds == [],
k_fds =-1;
elseif k_fds == 1,
if modn < 4,
w = logspace(l,3,100);
if modn == 1,
gain = sprintf('Gain of Ego = %g',Ge);
[gn,ph] = bode(NEol,DEol,w);
elseif modn == 2,
gain = sprintf('Gain of Id = %g',Gi);
[gn,ph] = bode(NIol,DIol,w);
gain = sprintf('Gain of Sego = %g',Gs);
[gn,ph] = bode(NSol,DSol,w);

gn = 20*logl0(gn);
title(['Open Loop Bode Plot ',Name,' '.modi])
xlabel('Frequency (R/S)')
ylabel('Gain (dB)')
plot(w,ph,'-',[l 1000],[-180 -180],-')
xlabel(Frequency (R/S)')
ylabel('Phase (deg)')
clear w
clear gn
clear ph
elseif k_fds == 2,
if modn < 5,
if modn == 1,
gain = sprintf('Gain of Ego = %g',Ge);
[a,b,c,d] = tf2ss(NEol,DEol);
[a,b,c,d] =feedback(a,b,c,d,[0], [0] ,[0], [ 1 ]);
elseif modn == 2,
gain = sprintf('Gain of Id = %g',Gi);
[a,b,c,d] = tf2ss(NIol,DIol);
elseif modn == 3,
gain = sprintf('Gain of Sego = %g',Gs);
[a,b,c,d] = tf2ss(NSol,DSol);
elseif modn == 4,
gain = sprintf('Gain of Rep = %g',Gr);
[a,b,c,d] = tf2ss(Nrep,Drep);
w = logspace(l,3,100);
[] = bode(a,b,c,d,l,w);
gn = 20*logl0(gn);
title(['Closed Loop Bode Plot '.Name,' .modi])
xlabel('Frequency (R/S)')
ylabel('Gain (dB))

xlabel(Frequency (R/S)')
ylabel('Phase (deg)')
clear gn
clear ph
clear w
clear a
clear b
clear c
if modn < 4,
rlgain = logspace(. 1,4,500);
if modn == 1,
rl = rlocus(NEol/Ge,DEol,rlgain);
zrl =rlocus(NEol/Ge,DEol,[le6]);
prl = rlocus(NEol/Ge,DEol,[0]);
clrt = rlocus(NEol/Ge,DEol,Ge);
elseif modn = 2,
rl = rlocus(NIol/Gi,DIol,rlgain);
zrl = rlocus(NIol/Gi,DIol,[le6]);
prl = rlocus(NIol/Gi,DIol,[0]);
clrt = rlocus(NIol/Gi,DIol,Gi);
rl = rlocus(NSol/Gs,DSol,rlgain);
zrl = rlocus(NSol/Gs,DSol,[le6]);
prl = rlocus(NSol/Gs,DSol,[0]);
clrt = rlocus(NSol/Gs,DSol,Ge);
title(['Root Locus ',Name,' ',modl])

clear rlgain
clear zrl
clear prl
clear clrt
m em
Code for Time Domain Simulations
Code for the Subsystem Time Studies Menu
k_ts = -1;
while k_ts == -1,
k_ts = menu(['Time Responses for ',Name,'s .modi],
'Impulse Response',...
'Step Response',...
'Emotional Modulated Response');
if modn == 1,
gain = sprintf('Gain of Ego = %g',Ge);
[a,b,c,d] = tf2ss(NEol,DEol);
[a,b ,c,d] =feedback(a,b ,c,d,[0], [0] ,[0], [ 1 ]);
elseif modn == 2,
gain = sprintf('Gain of Id = %g',Gi);
[a,b,c,d] = tf2ss(NIol,DIol);
elseif modn == 3,
gain = sprintf('Gain of Sego = %g',Gs);
[a,b,c,d] = tf2ss(NSol,DSol);
[a,b,c,d] =feedback(a,b,c,d, [0], [0], [0], [ 1 ]);
elseif modn == 4,
gain = sprintf('Gain of Rep = %g',Gr);
[a,b,c,d] = tf2ss(Nrep,Drep);
elseif modn == 5,

if modn < 5,
if k_ts == 1,
y = impulse(a,b,c,d,l,T);
title(['Impulse Response of ',Name,' ,modl]);
xlabel('Time (sec)');
elseif k_ts == 2,
y = step(a,b,c,d,l,T);
title(['Step Response of '.Name,' ',modl]);
xlabel('Time (sec)');
elseif k_ts == 3,
if modn == 1,
Mod = AmpMod(Upcar,Upobj,T);
elseif modn == 2,
Mod = AmpMod(Uicar,Uiobj,T);
elseif modn == 3,
Mod = AmpMod(Uscar.Usobj.T);
[Pyy,f] = PSD(Mod,T,npts);
title(['Modulated Input Signal to '.Name,' '.modi]);
plot(f,Pyy( 1 :npts/2))
title(['PSD of Input Signal to .Name,' .modi]);
xlabel('Frequency (Hz)')
y = lsim(a,b,c,d,Mod,T');
[Pyy.f] = PSD(y.T.npts);
title(['Output Response of '.Name,' '.modi]);
xlabel(Time (sec)');

plot(f,Pyy (1 :npts/2))
title(['PSD of Output Signal from ,Name,' ,modl]);
xlabel('Frequency (Hz)')
elseif modn == 5,
Up = AmpMod(Upcar,Upobj,T);
Ui = AmpMod(Uicar,Uiobj,T);
Us = AmpMod(Uscar,Usobj,T);
Ur = zeros(Ui);
[Pup,f] = PSD(Up,T,npts);
[Pui,f] = PSD(Ui,T,npts);
[Pus,f| = PSD(Us,T,npts);
% Run simulation System outputs
Z = lsim(A,B,C,D,[Up' Ui' Us' Ur'],T');
[Pze,f] = PSD(Z(:,l),T,npts);
[Pzi,f] = PSD(Z(:,2),T,npts);
[Pzs,f] = PSD(Z(:,3),T,npts);
[Pzrf] = PSD(Z(:,4),T,npts);
% System inputs
Egojn = Up' Z(:,4) Z(:,3);
Id_in = Ui' + Z(:,l);
Sego_in = Us' + Z(:,2);
[Pego_in,f] = PSD(Ego_in,T,npts);
[Pid_in,f] = PSD(Id_in,T,npts);
[Psego_in,f] = PSD(Sego_in,T,npts);
%Plot the EGO
clg % Environment
title(['Modulated Environmental Signal to ',Name,' Ego']);
plot(f,Pup( 1 :npts/2))
title(['PSD of Environmental Signal to ',Name,' Ego']);
xlabel(Frequency (Hz)')
clg % Rep Output
gain = sprintf('Gain of Rep = %g',Gr);
title(['Output Response of ',Name,' Rep']);

xlabel('Time (sec)');
plot(f,Pzr( 1 :npts/2))
title(['PSD of Output Signal from '.Name,' Rep']);
xlabel('Frequency (Hz)')
clg % Sego Output
gain = sprintf(Gain of Sego = %g,Gs);
title(['Output Response of ',Name,' Sego']);
xlabel('Time (sec)');
plot(f,Pzs(l :npts/2))
title(['PSD of Output Signal from '.Name,' Sego']);
xlabel('Frequency (Hz)')
clg % Perceived input to EGO
title(['Signal as Perceived by '.Name,' Ego']);
plot(f,Pego_in(l :npts/2))
title(['PSD of Perceived Signal to '.Name,' Ego']);
xlabel('Frequency (Hz)')
clg % Ego Output
gain = sprintf('Gain of Ego = %g',Ge);
title(['Output Response of '.Name,' Ego']);
xlabel('Time (sec)');
plot(f,Pze( 1 :npts/2))
title(['PSD of Output Signal from '.Name,' Ego']);
xlabel('Frequency (Hz)')

clg % Instincts into Id
titleC['Modulated Instinctual Signal to ',Name,' Id']);
plot(f,Pui(l :npts/2))
title(['PSD of Instinctual Signal to '.Name,' Id']);
xlabel('Frequency (Hz)')
clg % Combined input to Id
title(['Combined Signal to ',Name,' Id']);
plot(f,Pid_in( 1 :npts/2))
title(['PSD of Combined Signal to ',Name,' Id']);
xlabel('Frequency (Hz)')
clg % Id Output
gain = sprintf('Gain of Id = %g',Gi);
title(['Output Response of ',Name,' Id']);
xlabel('Time (sec)');
plot(f,Pzi( 1 :npts/2))
title(['PSD of Output Signal from ',Name,' Id']);
xlabel('Frequency (Hz)')
clg % Instinct into the Sego
title(['Modulated Instinctual Signal to ',Name,' Sego]);

plot(f,Pus( 1 :npts/2))
title(['PSD of Instinctual Signal to ',Name,' Sego']);
xlabel('Frequency (Hz)')
clg % Combined input to SEGO
title(['Combined Signal to ',Name,' Sego']);
plot(f,Psego_in (1 :npts/2))
title(['PSD of Combined Signal to '.Name,' Sego']);
xlabel('Frequency (Hz)')
clg % Sego Output
gain = sprintf('Gain of Sego = %g',Gs);
title(['Output Response of ',Name,' Sego']);
xlabel('Time (sec)');
plot(f ,Pzs( 1 :npts/2))
title([PSD of Output Signal from ',Name,' Sego']);
xlabel('Frequency (Hz)')
Amplitude modulation
function [AM] = AmpMod(Car,Obj,T);
% inputs
% Car = [C wc] C = carrier amplitude
% wc = carrier freqs (Hz)
% Obj = [O wo] O = object amplitude
% wo = object freqs (Hz)
% T = [To:dt:Tf]', time vector

[m,n] = size(Obj);
OB = zeros(T);
fori= l:l:m,
for j = 1:1 :max(size(T)),
OB(j) = Obj(i,l)*sin(2*pi*Obj(i,2)*T(j)) + OB(j);
[Py y>f] =PSD (OB ,T,256);
title('Object Signal')
plot(f,Pyy( 1:256/2))
title('PSD Signature of Object')
for i = l:l:m,
for j = l:l:max(size(T)),
if Car(i,2) == 0,
AM(j) = OB(j);
AM(j) = OB (j) *Car(i, 1 )*sin(2*pi* Car(i,2) *T(j)) + AM(j);