System Identification - input data file?
5 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
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
sys = tfest(data, 2)
figure
compare(data, sys)
grid
.
0 Comments
See Also
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!