% Tests the fngen method of the pzmodel class.
% 
% M Hewitson 18-04-08
% 
% $Id: test_pzm_fngen.m,v 1.2 2008/06/13 13:51:46 hewitson Exp $
% 
clear all;


% 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
b = fngen(pzm, plist('Win', swin, 'Nsecs', Nsecs)); % create time-series

% Plot time-series
iplot(b)

%% Make spectra and compare to response

sxx = pwelch(b, plist('Nfft', 100*b.data.fs, 'Scale', 'ASD'));
axx = abs(resp(pzm, plist('f', sxx.data.x)));
% iplot(axx./sxx, plist('YScales', {'All', 'lin'}))
iplot(sxx, axx)

