 Frequency Domain System Identification - Maple Programming Help

Home : Support : Online Help : Math Apps : Engineering and Applications : applications/FrequencyDomainSystemIdentification

Frequency Domain System Identification

System identification deals with the problem of identifying a model to accurately describe the response of a physical system to some input. This worksheet uses a spring-mass-damper system to illustrate the problem where the structure of the model is known and the parameters of the model are to be identified.

Identifying the model parameters that best describe the physical system is accomplished by exciting the system with a realistic input signal. The resulting output is then converted to the frequency domain and the parameters are estimated using a least-squares approximation approach.

System Definition

 • Parameter Definition
 • Variable Definition
 • Model Definition

Signal Generation and Simulation

Discrete Fourier Transform Calculations

Model-Based Parameter Estimation System Definition

The parameters, variables, and equations that define the spring-mass-damper model are found in the following sections:

Parameter Definition

 Name Value Units Parameters Mass of the object $\left(m\right)$ $⟦\mathrm{kg}⟧$ Damping coefficient ($b$) $⟦\frac{\mathrm{kg}}{s}⟧$ Spring constant $\left(k\right)$ $⟦\frac{N}{m}⟧$ Simulation time $\left(\mathrm{Tsim}\right)$ $⟦s⟧$ Sampling time $\left(\mathrm{Ts}\right)$ $⟦s⟧$ Number of samples $\left(\mathrm{Ns}\right)$  Noise standard deviation $\left(\mathrm{std}\right)$

Retrieve parameters

Variable Definition

 Name Description Input Variables $u\left(t\right)$ Input force on the mass Output Variables $y\left(t\right)$ Output position of the mass

Model Definition

$\mathrm{MassSpringDamperEq}≔M\cdot \stackrel{..}{y}+b\cdot \stackrel{.}{y}+k\cdot y\left(t\right)=u\left(t\right)$

 ${M}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}{}{y}{}\left({t}\right)\right){+}{b}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{y}{}\left({t}\right)\right){+}{k}{}{y}{}\left({t}\right){=}{u}{}\left({t}\right)$ (1)

 $\left[{y}{}\left({0}\right){=}{0}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{0}\right]$ (2)



$\mathrm{ParameterList}≔\left[M=\mathrm{mvalue},k=\mathrm{kvalue},b=\mathrm{bvalue}\right]$

 $\left[{M}{=}{5}{,}{k}{=}{3}{,}{b}{=}{2}\right]$ (3)



$\mathrm{MassSpringDamperSys__continuous}≔\mathrm{DiffEquation}\left(\mathrm{MassSpringDamperEq},\mathrm{inputvariable}=\left[u\left(t\right)\right],\mathrm{outputvariable}=\left[y\left(t\right)\right]\right):$

$\mathrm{MassSpringDamperSys}≔\mathrm{ToDiscrete}\left(\mathrm{MassSpringDamperSys__continuous},\mathrm{Ts}\right):\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{PrintSystem}\left(\mathrm{MassSpringDamperSys}\right)$

 $\left[\begin{array}{l}{\mathbf{Diff. Equation}}\\ {\mathrm{discrete; sampletime = .5e-1}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{u}{}\left({q}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{y}{}\left({q}\right)\right]\\ {\mathrm{de}}{=}{[}{M}{}\left({400.0000000}{}{y}{}\left({q}\right){-}{800.0000000}{}{y}{}\left({q}{+}{1}\right){+}{400.0000000}{}{y}{}\left({q}{+}{2}\right)\right){+}{b}{}\left({-}{20.00000000}{}{y}{}\left({q}\right){+}{20.00000000}{}{y}{}\left({q}{+}{1}\right)\right){+}{k}{}{y}{}\left({q}\right){=}{u}{}\left({q}\right){]}\end{array}\right$ (4)

${}$

Signal Generation and Simulation



Excitation Input

System Response

To excite the system, we apply a discrete chirp signal that sweeps the frequency spectrum from 0.01 Hz to 1 Hz over 50 seconds.



$\mathrm{InputSignal}≔\mathrm{Chirp}\left(1,\frac{0.99}{50},0.01,\mathrm{hertz}=\mathrm{true},\mathrm{discrete}=\mathrm{true},\mathrm{samplecount}=\mathrm{Ns},\mathrm{sampletime}=\mathrm{Ts}\right):$



noise is added to reflect a realistic application.



$\mathrm{NoisyInput}≔\mathrm{InputSignal}+~\mathrm{NoiseVector}:$



$\mathrm{TimeVector}≔\mathrm{convert}\left(\left[\mathrm{seq}\left(i,i=0.05..\mathrm{Tsim},\mathrm{Ts}\right)\right],\mathrm{Vector}\left[\mathrm{column}\right]\right):$





The system response to $\mathrm{InputSignal}$ can be obtained using the DynamicSystems[Simulate] command. The response can be seen in the following plot.



$\mathrm{plot1}≔\mathrm{plot}\left(\mathrm{TimeVector},\mathrm{OutputResponse},\mathrm{legend}="output response"\right):$

$\mathrm{plot2}≔\mathrm{plot}\left(\mathrm{TimeVector},\mathrm{NoisyInput},\mathrm{color}=\mathrm{blue},\mathrm{legend}="input signal",\mathrm{transparency}=0.3\right):$

$\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{plot1},\mathrm{plot2}\right],\mathrm{gridlines}=\mathrm{true}\right)$ ${}$



Discrete Fourier Transform Calculations



The results of converting the input, output and model signals to the frequency domain can be seen in the plots below. The Maple commands used to generated the Discrete Fourier Transform are found in the code edit region.

 DFT calculations -

Model-Based Parameter Estimation

The Maple commands used to obtain the model-based parameter values are found in the following code edit region.

Parameter Estimation Proc



Using Maple's optimization routines, the parameter values that best describe the physical model were found to be:

$\mathrm{EstimatedParameters}$

 $\left[{M}{=}{5.04376360521157}{,}{b}{=}{1.86287901484504}{,}{k}{=}{3.02288130522145}\right]$ (5)

The difference in parameter values between those measured and those obtained through the estimation process are shown below.



 $\left[{\mathrm{Δb}}{=}{-}{0.137120985154965}{,}{\mathrm{Δk}}{=}{0.0228813052214467}{,}{\mathrm{ΔM}}{=}{0.0437636052115664}\right]$ (6)

The plot below shows the frequency response of the measured and the estimated model.