|
FhSim
3.1.0
Marine systems simulation
|
Vector fitting of a rational transfer function to frequency data. More...
#include <Vectorfit.h>
Public Member Functions | |
| VectorFit () | |
| Sets the defaults: Fitoption 2, RelaxedConstraint false, FlipUnstable true, PoleIdentification true, ResidueIdentification true, ComplexStateSpace false. | |
| int | Fitoption () const |
| The terms of the fit: 1 fits with D = 0 and E = 0, 2 fits with D free and E = 0 (default), 3 fits with D and E free. | |
| void | Fitoption (int val) |
| bool | RelaxedConstraint () const |
| Use the relaxed non-triviality constraint in the pole identification. Default false. | |
| void | RelaxedConstraint (bool val) |
| bool | FlipUnstable () const |
| Mirror poles with a positive real part to the left half plane. Default true. | |
| void | FlipUnstable (bool val) |
| bool | PoleIdentification () const |
| Do the pole identification. When false, that part of Fit() is skipped and the returned C, D and E are zero (see Fit() in Vectorfit.cpp). Default true. | |
| void | PoleIdentification (bool val) |
| bool | ResidueIdentification () const |
| Do the residue identification (C, D and E). When false, only the poles are identified. Default true. | |
| void | ResidueIdentification (bool val) |
| bool | ComplexStateSpace () const |
| Stored as an option; Fit() does not read it. | |
| void | ComplexStateSpace (bool val) |
| mat | MatrixAreal () const |
| mat | MatrixBreal () const |
| mat | MatrixCreal () const |
| double | MatrixDreal () const |
| double | MatrixEreal () const |
| mat_complex | Diff () const |
| Fit minus data at the points of the last Fit() (when the poles were identified). | |
| double | Rmserr () const |
| Root mean square of Diff(). | |
| void | Fit (const vec_complex &f, const vec_complex &s, vec_complex &poles, const vec &weight) |
| One iteration of vector fitting. | |
| vec_complex | LinSolveLS (mat &A, mat &B) |
| vec_complex | LinSolve (mat &A, mat &B) |
| vec_complex | MatrixPolynomial (const mat_complex &A) |
| vec_complex | EigenValues (const mat_complex &ZER) |
| void | QRFactor (mat &A_new, mat &Q, mat &R) |
| void | TransferFunction (vec_complex &num, vec_complex &den) |
Result of the last Fit(): the model \f$ f(s) = C (sI - A)^{-1} B + D + E s \f$ with A diagonal (the poles) and B all ones. | |
| mat_complex | MatrixA () const |
| void | MatrixA (mat_complex val) |
| mat_complex | MatrixB () const |
| void | MatrixB (mat_complex val) |
| mat_complex | MatrixC () const |
| void | MatrixC (mat_complex val) |
| std::complex< double > | MatrixD () const |
| void | MatrixD (std::complex< double > val) |
| std::complex< double > | MatrixE () const |
| void | MatrixE (std::complex< double > val) |
Public Attributes | |
| EIGEN_MAKE_ALIGNED_OPERATOR_NEW | |
Fits \( f(s) \approx \sum_i c_i/(s - a_i) + d + e s \) to complex data \( f \) given at the complex points \( s \), by relocating a set of start poles \( a_i \) (pole identification) and then finding the residues \( c_i \) and the terms \( d \) and \( e \) (residue identification). It is used by FreqDomainIdent to identify the radiation model from the frequency domain data of the hull. Set the options, call Fit() (several times to iterate the poles), and read the state-space model with MatrixA() to MatrixE() or the polynomial form with TransferFunction().
vec, mat, vec_complex and mat_complex are typedefs of Eigen types in namespace Ship. | void Ship::VectorFit::Fit | ( | const vec_complex & | f, |
| const vec_complex & | s, | ||
| vec_complex & | poles, | ||
| const vec & | weight | ||
| ) |
Relocates the poles and then identifies the residues. Calling it again with the poles it returns iterates the fit. A start pole that is exactly 0 is replaced by -i/100 (i is its index).
| [in] | f | Complex data to fit, one value per point. |
| [in] | s | Complex Laplace variable at each point. FreqDomainIdent passes \( s = j\omega \) with \( \omega \) the frequency vector of the hull data, with no factor 2 pi: the poles and the model are in the unit of that vector. The tests (tests/Vectorfit_Test.cpp) use rad/s. The code does not check the unit. |
| [in,out] | poles | Start poles on input (complex pairs next to each other); the new poles on output. |
| [in] | weight | One weight per point, or one value for all points. |