Difference between bode and freqz

I create a filter in MATLAB like this:

[num,den] = ellip(10,0.1,50,4000/22050,'high');

      

Using freqz , I found the frequency response of the filter as follows:

freqz(num,den)

      

This gives the expected high pass filter graph. However, if I try to plot the same set of values ​​using the bode function , I get something completely different.

bode(tr(num,den))

      

This creates a graph of the low pass filter. Can't I understand how these functions work? I believe freqz used transfer function coefficients as arguments. This is also what I do with the bode function.

Why the difference?

+3


source to share


1 answer


[b,a] = ellip(n,Rp,Rs,Wp)

      

where b,a

are representatives of the z-area,

enter image description here

and tf

by default - for s-domain:

you can use filt

instead,



[b,a] = ellip(10,0.1,50,4000/22050,'high');
freqz(b,a) 
figure
bode(filt(b,a))

      

You can also use bode(tf(b,a,-1,'variable','z^-1'))

.

Check variable property

on tf

.

A string that defines the display variable of the transfer function. The variable can take the following values:

's' - Default for continuous time models

'z' - Default value for discrete time models

'p' is equivalent to 's'

'q' - equivalent to 'z'

'z ^ -1' - Reverse value of 'z'

'q ^ -1' - Equivalent to 'z ^ -1'

+2


source







All Articles