Closed VictuarVi closed 1 month ago
z/{0.9},
p/{-0.2, -8},
k/-0.5625%
Gives you the Bode plot of $$G(s) = \frac{-0.5625(-0.9+s)}{(s+0.2)(s+8)}$$, not $$G(s) = \frac{(-0.9+s)}{(s+0.2)(s+8)}$$.
If you want Bode plot of $$G(s) = \frac{(-0.9+s)}{(s+0.2)(s+8)}$$, then k should be 1.
The ZPK form I used is similar to MATLAB, where k is not the DC gain of the system.
The lines not being exactly straight is a consequence of sampling. If you increase the number of samples by changing the command to something like asymptotic/{orange,thick,samples=200}
, the asymptotic plot will look better.
Oh wow, thanks! it works (both of the solutions you posted).
I just have one last question. According to the documentation, if I write:
\begin{BodeMagPlot}[%
axes/{
ytick distance=10,
height=4cm,width=10cm,
xlabel={Frequenza (rad/s)},
ylabel={Guadagno (dB)},
},
commands/{\node at (axis cs: 0.9,-20) [circle,fill,inner sep=0.05cm label=below left:{$p_i$}]{};}
]
[...]
in the options of BodeMagPlot
, a note should appear. That's nearly the same syntax as the one used in the example of BodeTF
(except without the mag/
part).
Despite that, LaTeX returns the error: Package pgfkeys: I do not know the key '/tikz/commands' and I am going to ignore it. Perhaps you misspelled it.
.
I did not add the commands
option to any environments since you can simply add the tikz
code inside the environment itself.
\begin{BodeMagPlot}[%
axes/{
ytick distance=10,
height=4cm,width=10cm,
xlabel={Frequenza (rad/s)},
ylabel={Guadagno (dB)},
},
]
\node at (axis cs: 0.9,-20) [circle,fill,inner sep=0.05cm label=below left:{$p_i$}]{};
[...]
\end{BodeMagPlot}
Thanks. It works.
Wrong starting phase
By plotting the following function:
The starting phase should be -180° ($\Re (k) < 0$), while the plot starts at phase 0°:
also, as you can tell, the zeroes and poles have a "slight off" line. It should be perfectly straight, but it isn't. The transfer function is: $$G(s) = \frac{(-0.9+s)}{(s+0.2)(s+8)}$$ which, from by calculations, has:
For some reason, the magnitude plot too is incorrect:
because $20 \log_{10} (|-0.5625|) \approx -5 \text{ dB}$, not $-10$ as seen in the plot.
However, if I change the gain to $k = 1$, the plot becomes correct: