LTPDA Toolbox™ | contents | ![]() ![]() |
TDFIT fit a set of smodels to a set of input and output signals.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: TDFIT fit a set of smodels to a set of input and output signals. CALL: b = tdfit(outputs, pl) INPUTS: outputs - the AOs representing the outputs of a system. pl - parameter list (see below) OUTPUTs: b - a pest object containing the best-fit parameters, goodness-of-fit reduced chi-squared, fit degree-of-freedom covariance matrix and uncertainties. Additional quantities, like the Information Matrix, are contained within the procinfo. The best-fit model can be evaluated from pest\eval. Parameters Description EXAMPLES: % 1) Sine-wave stimulus of a simple system % Sine-wave data data = ao(plist('tsfcn', 'sin(2*pi*3*t) + 0.01*randn(size(t))', 'fs', 100, 'nsecs', 10)); data.setName; % System filter pzm = pzmodel(1, 1, 10); f = miir(pzm); % Make output signal dataf = filter(data, f); dataf.setName; % fit model to output mdl = smodel('(a.*(b + 2*pi*i*f)) ./ (b*(a + 2*pi*i*f))'); mdl.setParams({'a', 'b'}, {2*pi 10*2*pi}); mdl.setXvar('f'); params = tdfit(dataf, plist('inputs', data, 'models', mdl, 'P0', [1 1])); % Evaluate fit mdl.setValues(params); BestModel = fftfilt(data, mdl); BestModel.setName; iplot(data, dataf, BestModel, plist('linestyles', {'-', '-', '--'})) % recovered parameters (in Hz) params.y/2/pi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Method Details | |
---|---|
Access | public |
Defining Class | ao |
Sealed | 0 |
Static | 0 |
Sets for this method … |
---|
Default |
Default |
|||
---|---|---|---|
no description | |||
Key | Default Value | Options | Description |
tdfit | |||
INPUTS | [] | none | An array of input AOs, one per each experiment. |
MODELS | [] | none | An array of transfer function SMODELs. |
PADRATIO | 1 | none | PadRatio is defined as the ratio between the number of zero-pad points and the data length. Define how much to zero-pad data after the signal. Being tdfit a fft-based algorithm, no zero-padding might bias the estimation, therefore it is strongly suggested to do that. |
WHFLTS | [] | none | An array of FILTERBANKs containing the whitening filters per each output AO. |
PNAMES | {} [0x0] | none | A cell-array of parameter names to fit. |
P0 | [] | none | An array of starting guesses for the parameters. |
LB | [] | none | Lower bounds for the parameters. This improves convergency. Mandatory for Monte Carlo. |
UB | [] | none | Upper bounds for the parameters. This improves the convergency. Mandatory for Monte Carlo. |
ALGORITHM | 'fminsearch' |
|
A string defining the fitting algorithm. fminunc, fmincon require 'Optimization Toolbox' to be installed. patternsearch, ga, simulannealbnd require 'Genetic Algorithm and Direct Search' to be installed. |
OPTSET | '' | none | An optimisation structure to pass to the fitting algorithm. See fminsearch, fminunc, fmincon, optimset, for details. See patternsearch, psoptimset, for details. See ga, gaoptimset, for details. See simulannealbnd, saoptimset, for details. |
SYMDIFF | 0 |
|
Use symbolic derivatives or not. Only for gradient-based algorithm or for LinUnc option. |
DIFFORDER | 1 |
|
Symbolic derivative order. Only for SymDiff option. |
FITUNC | 1 |
|
Fit parameter uncertainties or not. |
UNCMTD | 'hessian' |
|
Choose the uncertainties estimation method. For multi-channel fitting hessian is mandatory. |
LINUNC | 1 |
|
Force linear symbolic uncertainties. |
GRADSEARCH | 0 |
|
Do a preliminary gradient-based search using the BFGS Quasi-Newton method. |
MONTECARLO | 0 |
|
Do a Monte Carlo search in the parameter space. Useful when dealing with high multiplicity of local minima. May be computer-expensive. Note that, if used, P0 will be ignored. It also requires to define LB and UB. |
NPOINTS | 100000 | none | Set the number of points in the parameter space to be extracted. |
NOPTIMS | 10 | none | Set the number of optimizations to be performed after the Monte Carlo. |
SINGLEINPUTSINGLEOUTPUT | 0 |
|
Specify whether the model should be considered as Single-Input/Single-Output model. This is for performance. |
Example |
---|
plist('INPUTS', [[]], 'MODELS', [[]], 'PADRATIO', [1], 'WHFLTS', [[]], 'PNAMES', cell(0,0), 'P0', [[]], 'LB', [[]], 'UB', [[]], 'ALGORITHM', 'fminsearch', 'OPTSET', '', 'SYMDIFF', [false], 'DIFFORDER', [1], 'FITUNC', [true], 'UNCMTD', 'hessian', 'LINUNC', [true], 'GRADSEARCH', [false], 'MONTECARLO', [false], 'NPOINTS', [100000], 'NOPTIMS', [10], 'SINGLEINPUTSINGLEOUTPUT', [false]) |
Some information of the method ao/tdfit are listed below: | |
---|---|
Class name | ao |
Method name | tdfit |
Category | Signal Processing |
Package name | ltpda |
VCS Version | 967b0eec0dece803a81af8ef54ad2f8c784b20b2 |
Min input args | 1 |
Max input args | -1 |
Min output args | 1 |
Max output args | -1 |
Can be used as modifier | 0 |
Supported numeric types | {'double'} |
![]() |
Method: ao/svd_fit | Method: ao/tfe | ![]() |
©LTP Team