Bode plot in Hz?

This one is pretty straightforward; How to generate a bode plot in Hz instead of radians/s?

I know matlab has bodeplot function which allows you to pick the x-axis unit but that’s not implemented in control yet.

I found this hack/workaround in mathworks forum but it doesn’t work…

Basically that’s attempting to brute force the gain + phase vectors out of bode function into Hz by multiplying them with 2*pi but it’s veryvery slow and doesn’t generate a graph. I get empty logarithmic grid but nothing drawn on it beyond the grid lines.

Instead of wout(:,1) in 2 places just use wout
or use wout(:,1)’
You have 1002 col instead of 1 col. with 1002 data points.

How is
different from
what does that extra apostrophe actually do?

In any case, I managed to fix this in a better way that doesn’t slow things down so badly. So instead of doing division by 2*pi on every column, I do this:

[mag, phase, wout] = bode(tf_plant,{1,1e9});
figure("position",[300 200 960 560]);
semilogx(wo, 20*log10(squeeze(mag)), "-"); zoom on; grid on;

I saw somewhere that doing iteration loops is bad and you should do vector operations instead, doing that wout/(2*pi) is much faster than doing it inside semilogx which presumably iterates every data point. Plus we do it only once, not twice.

the extra apostrophe transforms the variable form a row to a col. vector or
from a col. to a row vector. it is called transpose.