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?
1 Answer
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;
-
\$\begingroup\$ the first method shows error. I will try the second:>> plot(mag_3) Error using plot Data cannot have more than 2 dimensions. \$\endgroup\$– YaakovMay 18, 2020 at 11:17
-
\$\begingroup\$ @Yaakov Yes, the data comes out three-dimensional. You need to use
mag(:,:)
for that (only the third column or row has data). \$\endgroup\$ May 18, 2020 at 15:26
bode(); hold on; bode(); hold off;
. \$\endgroup\$