0
\$\begingroup\$

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?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ bode(); hold on; bode(); hold off;. \$\endgroup\$ May 18, 2020 at 7:42
  • \$\begingroup\$ 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? \$\endgroup\$
    – Yaakov
    May 18, 2020 at 7:54

1 Answer 1

1
\$\begingroup\$

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;
\$\endgroup\$
2
  • \$\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\$
    – Yaakov
    May 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.