Mercurial > hg > ltpda
diff m-toolbox/test/test_miir_redesign.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/test/test_miir_redesign.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,43 @@ +% When the filter command is given a standard filter designed for a +% different sample rate than the input data, we should redesign the filter +% on the fly. This can be done since the filter object contains the plist +% that was used to design it. +% +% M Hewitson 04-04-07 +% +% $Id: test_miir_redesign.m,v 1.9 2009/07/21 05:16:29 hewitson Exp $ +function test_miir_redesign() + + + % Make a filter + pl = plist('type', 'bandpass', 'fs', 1000, 'fc', [50 100], 'order', 3); + f = miir(pl) + + + % Make test AOs + nsecs = 10; + fs = 5000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + + a1 = ao(pl); + + % Filter the input data + [a2, f] = filter(a1,plist('filter', f)); + + % Plot time-series + iplot(a1, a2) + + % Make PSDs of input and output + nfft = 16384; + w = specwin('Hanning', nfft); + pl = plist('Win', w, 'Nfft', nfft); + + a3 = psd(a1, pl); + a4 = psd(a2, pl); + + % Plot PSDs + iplot([a3 a4]) + +end +% END +