Page 1 of 1

Matlab question

Posted: 2006-10-17 01:18pm
by The Jester
If I have two vectors which hold the coefficients for the transfer function of an analog filter (one vector for the numerator and one for the denominator) and a second pair of vectors which describe a the tranfer function of a digital filter, how would I go about plotting both systems' frequency responses on a single graph?

Posted: 2006-10-17 02:30pm
by Xenophobe3691
Depends. How do you want it arranged?

Generally, you can use the subplot command as so:

Code: Select all

subplot(# of plots, Arrangement of plots, Plot#);plot(t,x);then the rest.
Example:

Code: Select all

subplot(2,1,1);
subplot(2,1,2);
Would create:

Code: Select all

Plot 1               Plot 2
Whereas:

Code: Select all

subplot(2,2,1);
subplot(2,2,2);
Would create:

Code: Select all

Plot 1


Plot 2

Posted: 2006-10-18 11:07am
by The Jester
Xenophobe3691 wrote:Depends. How do you want it arranged?
Similar to the output figure of freqz or freqs with plots for both magnitude and phase responses for both filters.

Posted: 2006-10-18 01:11pm
by Gerald Tarrant
If you want multiple functions in the same plot/axes you can also use the

"hold"

or

"hold all"

hold all assigns different colors to each function