Second Order Model Identification 
using Moments 
Author's Data: Housam BINOUS
Department of Chemical Engineering
National Institute of Applied Sciences and Technology
Tunis, TUNISIA
Email: binoushousam@yahoo.com

Interpolation of experimental data

time={0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20};

ImpulseResponse={0,0.1215,0.1982,0.2392,0.2530,0.2470,
0.2278,0.2006,0.1694,0.1375,0.1070,0.0793,0.0553,0.0353,0.0193,0.0070,-0.0018,-0.0079,-0.0116,-0.0135,-0.0139,-0.0134,-0.0122,-0.0106,-0.0089,-0.0071,-0.0055,-0.0040,-0.0027,-0.0017,-0.0008,-0.0002,0.0001,0.0004,0.0006,0.0007,0.0007,0.0007,0.0006,0.0005,0.0004};

tt=Transpose[{time,ImpulseResponse}];

IR=Interpolation[tt,InterpolationOrder->1]

plt1=ListPlot[tt,PlotRange->All,PlotStyle->PointSize[0.02]]

Computing moments and normalized moments

Off[NIntegrate::slwcon]

Off[NIntegrate::ncvb]

(Subscript[M, 0]) = NIntegrate[IR[t], {t, 0, 20}]

(Subscript[M, 1]) = NIntegrate[t IR[t], {t, 0, 20}]

(Subscript[M, 2]) = NIntegrate[t^2 IR[t], {t, 0, 20}]

(Subscript[μ, 1]) = ((Subscript[M, 1])/(Subscript[M, 0]))

(Subscript[μ, 2]) = ((Subscript[M, 2])/(Subscript[M, 0]))

Computing second order model parameters

sol1 = 
      Solve[{(Subscript[a, 1]) == (Subscript[μ, 1]), 
          (Subscript[a, 2]) == (Subscript[μ, 1])^2 - (Subscript[μ, 2])/2}, {(Subscript[a, 1]), (Subscript[a, 2])}]

Obtaining the impulse response of the second order system with (Subscript[a, 1])=2.505 and (Subscript[a, 2])=3.501

u[t_]:=ϵ (UnitStep[t]-UnitStep[t-1/ϵ])

ϵ = 10000;

Plot[u[t],{t,0,5/ϵ},PlotStyle->RGBColor[0,0,1]]

sol2 = 
      NDSolve[{((Subscript[a, 2]) f''[t] + (Subscript[a, 1]) f'[t] + f[t] ==  
                u[t]) /. sol1, f[0] == 0, f'[0] == 0}, 
        f[t], {t, 0, 20}]

plt2=Plot[f[t]/.sol2,{t,0,20},PlotStyle->RGBColor[1,0,0],PlotRange->All]

Show[plt1,plt2]