Mercurial > hg > ltpda
view m-toolbox/test/test_mfir_from_spec.m @ 33:5e7477b94d94 database-connection-manager
Add known repositories list to LTPDAPreferences
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function test_mfir_from_spec() % TEST_MFIR_FROM_SPEC test script for mfir constructor from AO/fsdata. % % M Hewitson 14-05-07 % % $Id: test_mfir_from_spec.m,v 1.4 2008/09/19 14:03:50 ingo Exp $ % Ntaps = 512; %% Make ao % pole zero model pzm = pzmodel(1, [pz(0.1, 2) pz(0.5, 40)] , [pz(.03) pz(1.55, 25)]); % Compute time-series Nsecs = 1e4; % Number of seconds desired swin = specwin('Kaiser', 10, 150); % Blending window x12 = fngen(pzm, plist('Win', swin, 'Nsecs', Nsecs)); % create time-series %% Make spectrum pl = plist('Nfft', round(200*x12.data.fs)); x12xx = pwelch(x12, pl); %% Make filter ffs = mfir(x12xx, plist('N', Ntaps, 'Win', specwin('Hamming', 10))); rfs = resp(ffs, plist('f', [x12xx.data.x].')); pl = plist('nsecs', Nsecs,'fs', x12.data.fs,'tsfcn', 'randn(size(t))'); anoise = ao(pl); tic anew = filter(4*anoise, ffs); toc pl = plist('Nfft', round(200*x12.data.fs)); anewxx = pwelch(anew, pl); %% iplot(x12xx, rfs, anewxx) iplot(x12xx./anewxx) utils.plottools.yscale('lin') %% Make inverse filter ffs = mfir(1./x12xx, plist('N', Ntaps, 'Win', specwin('Hamming', 10))); rfs = resp(ffs, plist('f', x12xx.data.x)); iplot(rfs) x12wht = filter(x12, ffs); pl = plist('Nfft', round(200*x12.data.fs)); x12whtxx = pwelch(x12wht, pl); iplot(x12whtxx) return %% Write an m-file from AO pth = get_curr_m_file_path(mfilename); ao2m(x12l, [pth, 'test.m']); % now run it clear all test figure plot(a1) figure plot(a1.hist) % END % END