# how to plot on the same bode plot a manual function plot() with function bode()?

I have a a transfer function that I plotted manually using Plot(w,abs(f1(w)))(plotted for a digital filer since I dont have signal toolbox) and I have another function that I used directly bode(f2(s))(analog filter). I would like to plot them both in one bode plot?

• bode(); hold on; bode(); hold off;. – a concerned citizen May 18 at 7:42
• I know that one. but here I have plotted a transfer function with Plot() and and I have another one with bode(). so How I do Plot both at same bode plot? – Yaakov May 18 at 7:54

This is just a concept, but you could transform f2 to be a transfer function, e.g. tf2 = xx2tf(f2) (if it's not already, since it seems you are already talking about f2(s)), and then just run:

[F2mag, F2phi, w] = bode(tf2);


and then use mag, together with hold on/off and plot:

plot(w, abs(f1)), "", w, F2mag);


Or the reverse, transform f1 to tf() and then do as in the comment:

bode(...);
hold on;
bode(...);
hold off;

• the first method shows error. I will try the second:>> plot(mag_3) Error using plot Data cannot have more than 2 dimensions. – Yaakov May 18 at 11:17
• @Yaakov Yes, the data comes out three-dimensional. You need to use mag(:,:) for that (only the third column or row has data). – a concerned citizen May 18 at 15:26