LTPDA Toolbox™ | contents | ![]() ![]() |
sDomainFit performs a fitting loop to identify model order and parameters. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: sDomainFit fit a partial fraction model to frequency response data using the function utils.math.vcfit. The function performs a fitting loop to automatically identify model order and parameters in s-domain. Output is a s-domain model expanded in partial fractions: r1 rN f(s) = ------- + ... + ------- + d s - p1 s - pN The function attempt to perform first the identification of a model with d = 0, then if the operation do not succeed, it try the identification with d different from zero. % Identification loop stop when the stop condition is reached. Stop criterion is based on three different approachs: 1) Mean Squared Error and variation Check if the normalized mean squared error is lower than the value specified in FITTOL and if the relative variation of the mean squared error is lower than the value specified in MSEVARTOL. E.g. FITTOL = 1e-3, MSEVARTOL = 1e-2 search for a fit with normalized magnitude error lower than 1e-3 and and MSE relative variation lower than 1e-2. 1) Log residuals difference and root mean squared error Log Residuals difference Check if the minimum of the logarithmic difference between data and residuals is larger than a specified value. ie. if the conditioning value is 2, the function ensures that the difference between data and residuals is at lest 2 order of magnitude lower than data itsleves. Root Mean Squared Error Check that the variation of the root mean squared error is lower than 10^(-1*value). 2) Residuals spectral flatness and root mean squared error Residuals Spectral Flatness In case of a fit on noisy data, the residuals from a good fit are expected to be as much as possible similar to a white noise. This property can be used to test the accuracy of a fit procedure. In particular it can be tested that the spectral flatness coefficient of the residuals is larger than a certain qiantity sf such that 0<sf<1. Root Mean Squared Error Check that the variation of the root mean squared error is lower than 10^(-1*value). Both in the first and second approach the fitting loop stops when the two stopping conditions are satisfied. The output are AOs containing the frequency response of the fitted model, while the Model parameters are output as a parfrac model in the output AOs procinfo filed. The function can also perform a single loop without taking care of the stop conditions. This happens when 'AutoSearch' parameter is setted to 'off'. If you provide more than one AO as input, they will be fitted together with a common set of poles. CALL: mod = sDomainFit(a, pl) INPUTS: a - input AOs to fit to. If you provide more than one AO as input, they will be fitted together with a common set of poles. Only frequency domain (fsdata) data can be fitted. Each non fsdata object will be ignored. Input objects must have the same number of elements. pl - parameter list (see below) OUTPUTS: mod - matrix of one parfrac object for each input AO. Usseful fit information are stored in the procinfoi field: FIT_RESP - model frequency response. FIT_RESIDUALS - analysis object containing the fit residuals. FIT_MSE - analysis object containing the mean squared error progression during the fitting loop. Note: all the input objects are assumed to caontain the same X (frequencies) values EXAMPLES: 1) Fit to a frequency-series using Mean Squared Error and variation stop criterion % Create a frequency-series AO pl_data = plist('fsfcn', '0.01./(0.0001+f)', 'f1', 1e-5, 'f2', 5, 'nf', 1000); a = ao(pl_data); % Fitting parameter list pl_fit = plist('AutoSearch','on',... 'StartPoles',[],... 'StartPolesOpt','clog',... 'maxiter',5,... 'minorder',2,... 'maxorder',20,... 'weights',[],... 'CONDTYPE','MSE',... 'FITTOL',1e-3,... 'MSEVARTOL',1e-2,... 'Plot','off',... 'ForceStability','off',... 'direct term','off',... 'CheckProgress','off'); % Do fit b = sDomainFit(a, pl_fit); 2) Fit to a frequency-series using Log residuals difference and mean squared error variation stop criterion % Create a frequency-series AO pl_data = plist('fsfcn', '0.01./(0.0001+f)', 'f1', 1e-5, 'f2', 5, 'nf', 1000); a = ao(pl_data); % Fitting parameter list pl_fit = plist('FS',[],... 'AutoSearch','on',... 'StartPoles',[],... 'StartPolesOpt','clog',... 'maxiter',5,... 'minorder',2,... 'maxorder',20,... 'weights',[],... 'weightparam','abs',... 'CONDTYPE','RLD',... 'FITTOL',1e-3,... 'MSEVARTOL',1e-2,... 'Plot','off',... 'ForceStability','off',... 'CheckProgress','off'); % Do fit b = sDomainFit(a, pl_fit); 3) Fit to a frequency-series using Residuals spectral flatness and mean squared error variation stop criterion % Create a frequency-series AO pl_data = plist('fsfcn', '0.01./(0.0001+f)', 'f1', 1e-5, 'f2', 5, 'nf', 1000); a = ao(pl_data); % Fitting parameter list pl_fit = plist('FS',[],... 'AutoSearch','on',... 'StartPoles',[],... 'StartPolesOpt','clog',... 'maxiter',5,... 'minorder',2,... 'maxorder',20,... 'weights',[],... 'weightparam','abs',... 'CONDTYPE','RSF',... 'FITTOL',0.5,... 'MSEVARTOL',1e-2,... 'Plot','off',... 'ForceStability','off',... 'CheckProgress','off'); % Do fit b = sDomainFit(a, pl_fit); Parameters Description %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Method Details | |
---|---|
Access | public |
Defining Class | ao |
Sealed | 0 |
Static | 0 |
Sets for this method … |
---|
Default |
Default |
|||
---|---|---|---|
no description | |||
Key | Default Value | Options | Description |
sDomainFit | |||
AUTOSEARCH | 'on' |
|
'on': Parform a full automatic search for the transfer function order. The fitting procedure will stop when stop conditions defined are satisfied. 'off': Perform a fitting loop as long as the number of iteration reach 'maxiter'. The order of the fitting function will be that specified in 'minorder'. |
STARTPOLES | [] | none | A vector of starting poles. Providing a fixed set of starting poles fixes the function order. If it is left empty starting poles are internally assigned. |
STARTPOLESOPT | 'clog' |
|
Define the characteristics of internally assigned starting poles. Admitted values are:
|
MAXITER | 50 | none | Maximum number of iterations in fit routine. |
MINORDER | 2 | none | Minimum order to fit with. |
MAXORDER | 20 | none | Maximum order to fit with. |
WEIGHTS | [] | none | A vector with the desired weights. If a single Ao is input weights must be a Nx1 vector where N is the number of elements in the input Ao. If M Aos are passed as input, then weights must be a NxM matrix. If it is leaved empty weights are internally assigned basing on the input parameters |
WEIGHTPARAM | 'abs' |
|
Specify the characteristics of the internally assigned weights. Admitted values are:
|
CONDTYPE | 'MSE' |
|
Fit conditioning type. Admitted values are:
|
FITTOL | 0.001 | none | Fit tolerance. |
MSEVARTOL | 0.01 | none | Mean Squared Error Variation - Check if the realtive variation of the mean squared error is smaller than the value specified. This option is useful for finding the minimum of Chi-squared. |
PLOT | 'off' |
|
Plot results of each fitting step. |
FORCESTABILITY | 'off' |
|
Force poles to be stable |
DIRECT TERM | 'off' |
|
Fit with direct term. |
CHECKPROGRESS | 'off' |
|
Display the status of the fit iteration. |
DELAY | [] | none | Innput a delay that will be subtracted from the fit. |
Example |
---|
plist('AUTOSEARCH', 'on', 'STARTPOLES', [[]], 'STARTPOLESOPT', 'clog', 'MAXITER', [50], 'MINORDER', [2], 'MAXORDER', [20], 'WEIGHTS', [[]], 'WEIGHTPARAM', 'abs', 'CONDTYPE', 'MSE', 'FITTOL', [0.001], 'MSEVARTOL', [0.01], 'PLOT', 'off', 'FORCESTABILITY', 'off', 'DIRECT TERM', 'off', 'CHECKPROGRESS', 'off', 'DELAY', [[]]) |
Some information of the method ao/sDomainFit are listed below: | |
---|---|
Class name | ao |
Method name | sDomainFit |
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/rms | Method: ao/select | ![]() |
©LTP Team