Write a program in Lisp to demonstrate that a fuzzy system is a
structured
Numerical estimator-using example of controlling an inverted
pendulum.
(Enter two strings for angle of pendulum θ and angular velocity
Δθ.
Convert them into strings of fuzzy using five fuzzy set values
NM(Negative medium), NS (Negative Small), ZE(Zero), PS (Positive Small) and PM
( Positive Medium). Apply FAM rules to find the output values v,the current to
the motor control of the pendulum to each input set of (θ,Δθ). Create a string
of fuzzy output values of the current.)
(defun FAM (angPen anguVel)
(cond
((equal
angPen "NM")
(cond
((equal
anguVel "NM") nil)
((equal
anguVel "NS") nil)
((equal
anguVel "ZE") (print "PM"))
((equal
anguVel "PS") nil)
((equal
anguVel "PM") nil)
)
)
((equal
angPen "NS")
(cond
((equal
anguVel "NM") nil)
((equal
anguVel "NS") nil)
((equal
anguVel "ZE") (print "PS"))
((equal
anguVel "PS") nil)
((equal
anguVel "PM") nil)
)
)
((equal
angPen "ZE")
(cond
((equal
anguVel "NM") (print "PM"))
((equal
anguVel "NS") (print "PS"))
((equal
anguVel "ZE") (print "ZE"))
((equal
anguVel "PS") (print "NS"))
((equal
anguVel "PM") (print "NM"))
)
)
((equal
angPen "PS")
(cond
((equal
anguVel "NM") nil)
((equal
anguVel "NS") nil)
((equal
anguVel "ZE") (print "NS"))
((equal
anguVel "PS") nil)
((equal
anguVel "PM") nil)
)
)
((equal
angPen "PM")
(cond
((equal
anguVel "NM") nil)
((equal
anguVel "NS") nil)
((equal
anguVel "ZE") (print "NM"))
((equal anguVel "PS")
nil)
((equal
anguVel "PM") nil)
)
)
)
)
(FAM "NM" "ZE")
OUTPUT:
---- Done ----
FAM
---- Done ----
"PM"