# Drawing membership functions and fuzzy sets with LaTeX

1. How can I visualize in LaTeX Fuzzy Logic diagrams such as the following picture?
2. Also how I can visualize sets?

Is the better way to show Fuzzy diagrams as an image?

-
Well for Question #1 I would recommend tikz. Please make an attempt at the diagram and then people here can help you with any specific issues that may arise. Not sure what #2 is asking. – Peter Grill Nov 17 '12 at 19:21
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Mar 19 '14 at 20:35

One possibility using PGF/TikZ:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[->] (0,0) -- node[below] {quantized} (4.5,0) node[below] {Age};
\draw[->] (0,0) -- (0,1.5) node[left] {$\mu$};
\node at (-0.2,0) {0};
\node at (-0.2,1) {1};
\draw[fill=yellow] (0,1) -- (4,1) -- (4,0) -- (0,0) -- cycle;
\foreach \x in {0.5,1,1.5,2,2.2,3.4}
\draw (\x,0) -- (\x,1);
\begin{scope}[xshift=5.5cm]
\draw[->] (0,0) -- node[below] {granulated} (4.5,0) node[below] {Age};
\draw[->] (0,0) -- (0,1.5) node[left] {$\mu$};
\node at (-0.2,0) {0};
\node at (-0.2,1) {1};
\draw[fill=yellow!40] (0,1) -- (1,1) -- (1.75,0) -- (0,0) -- cycle;
\draw[fill=yellow!40] (2.25,0) -- (3,1) -- (4,1) -- (4,0) -- cycle;
\draw[fill=yellow!40] (1.25,0) -- (1.8,1) -- (2.3,1) -- (3,0) -- cycle;
\draw (1,1) -- (1.75,0) -- (2.25,0) -- (3,1);
\node[above,font=\footnotesize] at (0.5,1) {young};
\node[above,font=\footnotesize] at (2,1) {middle-aged};
\node[above,font=\footnotesize] at (3.5,1) {old};
\end{scope}
\node[anchor=south] at (current bounding box.north)
{\textbullet\ continuous $\rightarrow$ quantized $\rightarrow$ granulated};
\end{tikzpicture}

\end{document}