Main Content

Convert MIMO Matrix Data to Timetable for Continuous-Time Model Estimation

Estimate a continuous-time model function by first converting matrix data to a timetable.

Load the data, which includes input matrix usteam, output matrix ysteam, and sample time Ts.

load sdatasteam.mat usteam ysteam Ts

Combine usteam and ysteam into the single timetable ttsteam. In order to create a variable for each channel, you must specify each matrix column explicitly.

tts = timetable(usteam(:,1),usteam(:,2),ysteam(:,1),ysteam(:,2),...
    'rowtimes',seconds(Ts*(1:size(usteam,1))));
head(tts,4)
      Time       Var1       Var2        Var3        Var4   
    ________    _______    _______    ________    _________

    0.05 sec    -1.5283     2.0584     0.57733     -0.12274
    0.1 sec      1.4412     -2.005     0.75804    -0.086114
    0.15 sec     1.4314     2.0584    -0.76577     -0.19845
    0.2 sec      1.4412    -1.9806     0.47721     -0.20577

Estimate a continuous-time state-space model.

nx = 3;
sysc = ssest(tts,nx,'InputName',["Var1" "Var2"],'OutputName',["Var3" "Var4"]);

Compare the model to the data.

compare(tts,sysc)