System Identification - input data file?

5 views (last 30 days)
Emilijan
Emilijan on 3 Feb 2022
Edited: Star Strider on 4 Feb 2022
Hello!
(System Identification Toolbox addon)
I would like to work with System Identification in Matlab. Does anybody know how to create the input data file?
All demonstration I found on internet assume that you have a *.mat file containing u and y data that you can load, which is necessary to get transfer function. The question is, what is the structure, or how to create an input file containing u and y.
Kind regards

Answers (1)

Star Strider
Star Strider on 3 Feb 2022
Edited: Star Strider on 4 Feb 2022
If the ‘u’ and ‘y’ data are in the time domain, use the iddata function to create a data object that the estimation functions (such as tfest and ssest) can use to estimate the system. (Then use the compare function to visually explore the fit.)
The only absolute requirement is that ‘u’ and ‘y’ exist in the workspace that uses them and that they are the same size and are appropriate for the model being estimated. If they exist in a .mat file, they first need to be loaded into the workspace, however they do not have to start out in a .mat file, although they are usually read in from a .txt or Excel file simply because that is what the instrumentation that acquires the data writes them to.
EDIT — (4 Feb 2022 at 12:18)
Added this:
Example —
t = linspace(0, 10, 250);
u = [0 1 zeros(1, numel(t)-2)];
y = exp(-0.2*t) .* sin(2*pi*t) + randn(size(t))*0.1;
Ts = t(2)-t(1);
data = iddata(y(:), u(:), Ts) % Arguments Must Be Column Vectors Or Scalars
data = Time domain data set with 250 samples. Sample time: 0.0401606 seconds Outputs Unit (if specified) y1 Inputs Unit (if specified) u1
sys = tfest(data, 2)
Warning: For transient data (step or impulse experiment), make sure that the change in input signal does not happen too early relative to the order of the desired model. You can achieve this by prepending sufficient number of zeros (equilibrium values) to the input and output signals. For example, a step input must be represented as [zeros(nx,1); ones(N,1)] rather than ones(N,1), such that nx > model order.
sys = From input "u1" to output "y1": 3.874 s + 60.59 ---------------------- s^2 + 0.3961 s + 39.61 Continuous-time identified transfer function. Parameterization: Number of poles: 2 Number of zeros: 1 Number of free coefficients: 4 Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using TFEST on time domain data "data". Fit to estimation data: 72.73% FPE: 0.01015, MSE: 0.009674
figure
compare(data, sys)
grid
.

Categories

Find more on Linear Model Identification in Help Center and File Exchange

Products


Release

R2011b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!