Reply by Tim Wescott September 13, 20142014-09-13
On Fri, 12 Sep 2014 21:20:49 -0700, Peter Mairhofer wrote:

(top posting fixed)
> > On 2014-09-12 21:04, Peter Mairhofer wrote: >> Hi, >> >> A bessel filter should have nearly constant group delay up to a certain >> frequency. In my case, this should be fs=100MHz. >> >> What am I doing wrong with this MATLAB code? >> >> set(cstprefs.tbxprefs,'FrequencyUnits','Hz'); >> fs = 100e6; >> [num,den] = besself(9,2*pi*fs); >> H = tf(num,den); >> f_axis = logspace(3, 11, 10000); >> bode(H, f_axis);grid on; >> >> The result is http://snag.gy/wweJj.jpg which shows that the phase is >> constant up to 1 MHz but not up to 100 MHz. (Of course, if I plot the >> group delay it is not constant either). >> > > Sorry I think you can disregard the question. > > I made the same mistake again I did before: Forgot to take the > derivative wrt frequency. (i.e., not only diff(phase) but > diff(phase)./diff(frreq)) ...
And you plotted phase vs. log(frequency). Had you plotted phase vs. _linear_ frequency you should have seen a much straighter line. Don't count on getting over this with experience: 99% of the time you want to see stuff vs. log(frequency), so it's pretty common even for experts to forget when they're working in that 1%. You just need to pad your right hand so you don't get a concussion from slapping your forehead too much. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by kaz September 13, 20142014-09-13
you might just use the following functions:

freqz(num,den)
grpdelay(num,den)	 

_____________________________		
Posted through www.DSPRelated.com
Reply by Peter Mairhofer September 13, 20142014-09-13
Sorry I think you can disregard the question.

I made the same mistake again I did before: Forgot to take the
derivative wrt frequency. (i.e., not only diff(phase) but
diff(phase)./diff(frreq)) ...

On 2014-09-12 21:04, Peter Mairhofer wrote:
> Hi, > > A bessel filter should have nearly constant group delay up to a certain > frequency. In my case, this should be fs=100MHz. > > What am I doing wrong with this MATLAB code? > > set(cstprefs.tbxprefs,'FrequencyUnits','Hz'); > fs = 100e6; > [num,den] = besself(9,2*pi*fs); > H = tf(num,den); > f_axis = logspace(3, 11, 10000); > bode(H, f_axis);grid on; > > The result is http://snag.gy/wweJj.jpg which shows that the phase is > constant up to 1 MHz but not up to 100 MHz. (Of course, if I plot the > group delay it is not constant either). > > Thank you. > Peter >
Reply by Peter Mairhofer September 13, 20142014-09-13
Hi,

A bessel filter should have nearly constant group delay up to a certain
frequency. In my case, this should be fs=100MHz.

What am I doing wrong with this MATLAB code?

set(cstprefs.tbxprefs,'FrequencyUnits','Hz');
fs = 100e6;
[num,den] = besself(9,2*pi*fs);
H = tf(num,den);
f_axis = logspace(3, 11, 10000);
bode(H, f_axis);grid on;

The result is http://snag.gy/wweJj.jpg which shows that the phase is
constant up to 1 MHz but not up to 100 MHz. (Of course, if I plot the
group delay it is not constant either).

Thank you.
Peter