[Tex/LaTex] Draw Bode diagram


I want to recreate the following Bode diagram :

enter image description here

My problem is the curved line, I don't know the formula so I've to draw it manually but regretfully I'm not able to recreate it perfectly, here's my try :

enter image description here

\usetikzlibrary{angles, arrows.meta,

            tick style={draw=none},
\draw [blue] (axis cs:1e-2,-90) .. controls (axis cs:0.08,-75) .. (axis cs:0.3,-45);
\draw [blue] (axis cs:0.3,-45) .. controls (axis cs:1,-15) .. (axis cs:2,3);
\draw [blue] (axis cs:2,3) .. controls (axis cs:30,65) .. (axis cs:1e3,5);
\draw [red,dashed] (axis cs:1e-2,-90) -- (axis cs:1e-1,-90) -- (axis cs:1e-1,0) -- (axis cs:1e1,0) -- (axis cs:1e1,90) -- (axis cs:1e2,90) -- (axis cs:1e2,0) -- (axis cs:1e3,0);


Best Answer

From the phase plot, your transfer function has:

  • 1 integrator,
  • 1 pole (at w=100),
  • and 2 zeros (at w=0.1 and w=10).

It can be written as follows:

enter image description here

Here is my attempt using bodegraph package. You can also check this tutorial: The Easiest Way to Draw a BODE Plot in LaTeX!).




    gnuplot def/.append style={prefix={}},

 semilog lines/.style={black},
 semilog lines 2/.style={gray!50},
 semilog half lines/.style={gray!50, dotted},
 semilog label x/.style={below,font=\small},
 semilog label y/.style={above,font=\small} }


% y axis step

% Semilog grid

% Plot asymptotic lines
\draw[blue!80,dashed,line width=1.2] (-2,-90 ) -| (-1,0 ) -| (1,90) -|(2,0) -- (3,0);

% Phase plot of the transfer function

% Text node
\node[fill=white] at (-1,50){Phase ($^{\circ}$)};



which yields:

enter image description here

For a touch of style, suggested by @Sebastiano, you can modify opacity of the phase label as follows:

\node[fill=white,opacity=0.9] at (-1,50){Phase ($^{\circ}$)};

which yields: enter image description here

Related Question