Fuzzy Filtering
Dan Simon
Innovatia Software
dan@innovatia.com
Copyright 1998–2007 Innovatia Software. All Rights Reserved.
Preliminaries
Previous white papers by
Innovatia Software have focused on the topics of Kalman filtering, H-infinity filtering, and hybrid Kalman / H-infinity filtering. This paper discusses fuzzy logic,
a more heuristic approach to filtering. The application is fuzzy filtering for
phase-locked loops (PLLs), although the approach is general enough to be
applied to most estimation problems. See the H-infinity filtering and hybrid Kalman / H-infinity filtering papers for some basic information
about PLLs.
Fuzzy Logic
Fuzzy logic works the way that
humans think as opposed to the way that computers typically work. For example,
consider the task of driving a car. You notice that the stoplight ahead is red
and the car ahead is braking. Your mind might go through the thought process,
"I see that I need to stop. The roads are wet because it's raining and
there is a car only a short distance in front of me. Therefore I need to apply
a significant pressure on the brake pedal." This is all subconscious (in
general), but that's the way we think - in fuzzy terms. Do our brains compute
the precise distance to the car ahead of us and the exact coefficient of
friction between our tires and the road, and then use a Kalman filter to derive
the optimal pressure which should be applied to the brakes? Of course not. We
use common-sense rules and they seem to work pretty well. On the other hand,
when we do finally get around to pressing the brake pedal there is some exact
force that we apply, say 1.326 pounds. So although we think in fuzzy, noncrisp
ways, our final actions are crisp. The process of translating the results of
fuzzy reasoning to a crisp, nonfuzzy action is called defuzzification.
A Fuzzy Phase-Locked
Loop
Now think about how a fuzzy
phase-locked loop (PLL) might work. A PLL estimates the phase of a time-varying
sinusoidal signal which is corrupted by noise. In addition to the signal being
corrupted by noise, the PLL's phase measurement is noisy. The PLL's task is to
find the best estimate of the true phase in spite of the noise.
As the PLL estimates the
phase, it also predicts what the next phase measurement is going to be (based
on its past estimates). We will call the difference between the actual phase
measurement and the PLL's prediction of the measurement the error. The change
in error is the change in this quantity from one time period to the next.
So we can see that if the error is positive (i.e., the measured phase is larger
than I expected it to be based on past estimates), then I probably need to
increase my phase estimate or I may lose lock on the phase. If both the error
and the change in error is positive, then I probably need to increase my
estimate by a large amount because there may not be much time before I lose
lock. These specifications are called fuzzy rules. Below is a sample
table of fuzzy rules that might be used for PLL filtering. The inputs are Error
and Change in Error, and the possible outputs are in green and represent
how much to change the phase estimate.
|
CHANGE IN ERROR |
ERROR |
||
|
Negative |
Zero |
Positive |
|
|
Negative |
Large Neg. |
Negative |
Zero |
|
Zero |
Negative |
Zero |
Positive |
|
Positive |
Zero |
Positive |
Large Pos. |
The engineering challenge is
to define the fuzzy quantities. What does "zero" mean in fuzzy terms?
What does "large negative" mean? Our definition of these fuzzy terms
comprise what are called fuzzy membership functions. We may define a phase
error of 1 radian as 30% positive and 70% large positive; we may define a
phase error of 1 degree as 90% zero and 10% positive. One nice feature of
fuzzy logic is that the membership functions can be refined; they can be
optimized. The fuzzy system can be trained by tweaking the membership functions
so that the system performs optimally. This feature will come in handy later on
in this example.
Defuzzification
So suppose we have a phase
error of -15 degrees and a change in error of -10 degrees. How do
we actually figure out how to change our phase estimate based on the rules in
the table above? Well, suppose that a phase error of "negative" is
represented by the function on the left in the figure below. That is, a phase
error is considered negative only if it is between -25 and 0 degrees. A phase
error's level of membership increases from 0 to 1 as the error increases from
-25 to -12.5 degrees. The error's level of membership decreases from 1 to 0 as
the error increases from -12.5 to 0 degrees. So our phase error of -15 degrees
belongs to the negative class with a level of membership equal to 0.8.
Similarly, from the function in the center in the figure below, we see that our
change in error of -10 degrees belongs to the zero class with a level of
membership equal to 0.5. Our fuzzy rule from the table above says that if our
phase error is negative and our change in error is zero, then our output should
be negative. The fuzzy output corresponding to this rule is represented by the
function on the right in the figure below. We want a negative output, but our
output should only have a level of membership of 0.5 in the negative class.
This is because 0.5 is the minimum contributor to this rule.

But that's not all. Looking
at the function on the left in the figure below, we see that our phase error of
-15 degrees also belongs to the zero class with a level of
membership equal to 0.2. As before, from the function in the center in the figure
below, our change in error of -10 degrees belongs to the zero class with a
level of membership equal to 0.5. Another fuzzy rule from the table says that
if our phase error is zero and our change in error is zero, then our output
should be zero. The fuzzy output corresponding to this rule is represented by
the function on the right in the figure below. So we want a zero output, but
our output should only have a level of membership of 0.2 in the zero class.
Again, this is because 0.2 is the minimum contributor to this rule.

So now we have two fuzzy
outputs; a negative output with a 0.5 level of membership, and zero output with
a 0.2 level of membership. Next we perform defuzzification to convert our fuzzy
outputs to a single number. There are many ways of defuzzifying; one way is by
simply computing the centroid of the fuzzy outputs. This process is illustrated
in the figure below. In practice, there may be many fuzzy outputs to defuzzify.
To obtain a numeric output we can take the center of gravity of all of the
fuzzy outputs.

Conclusion
Innovatia Software's white
paper Gradient Descent Optimization of Fuzzy Functions shows how the fuzzy rules of a PLL
filter can be trained to optimize filter performance. The performance of the
optimal fuzzy filter is compared with the nominal, heuristic, non-optimized
filter discussed in this paper.
References
Fuzzy logic is a subject on
which many excellent books and papers have been written. A couple of texts that
I've found particularly useful are listed below. In particular, I gained most
of my early understanding of fuzzy logic from Bart Kosko's book. I was pretty
disappointed with the first half of his book, which deals with neural networks.
But the second half, which discusses fuzzy logic, is excellent.
·
B.
Kosko, "Neural Networks and Fuzzy Systems," Prentice Hall, 1992.
·
G.
Klir and B. Yuan, "Fuzzy Sets and Fuzzy Logic," Prentice Hall, 1995.
Kosko has also written a
popular and entertaining book on the topic which deals with fuzzy logic from a
cultural and social point of view.
·
B.
Kosko, "Fuzzy Thinking," Hyperion, 1993.
The Institute of Electrical
and Electronics Engineers (IEEE) publishes a quarterly journal called IEEE Transactions
on Fuzzy Systems, which contains cutting-edge research on the topic in each
issue.
There are also a lot of
internet resources about fuzzy logic. Some excellent web pages on the subject
are the following.
In addition, I have made
some MATLAB code available for the reduction of fuzzy rule bases. Fuzzy rule
base reduction may be important in those cases where a fuzzy system needs to be
implemented in real time. Click here for a short description of the algorithm and instructions
on how to download the MATLAB code.
Home
Credentials
Publications White Papers
Copyright 1998–2007 Innovatia. All Rights
Reserved.
Email Address: dan@innovatia.com
Phone Number: (216)687-5407
Last Revised: May 29, 2007