简体   繁体   English

使用不均匀(不规则)采样数据进行系统识别

[英]System Identification with nonuniform (irregular) sampled data

I am trying to identify the model of my quadcopter using MATLAB's System Identification toolbox (App) and the command line. 我正在尝试使用MATLAB的系统识别工具箱(App)和命令行来识别四轴飞行器的模型。 I have both the input and output signals which are both non-uniformly sampled , specifically, the sample time between consecutive measurements isn't constant throughout the experiment. 我的输入和输出信号都被非均匀采样 ,特别是在整个实验中,连续测量之间的采样时间并不是恒定的。

I found that it is possible to create a non-uniform data set on MATLAB using: 我发现可以使用以下方法在MATLAB上创建非统一数据集:

FlightData = iddata(inputs, outputs, [],'SamplingInstants', time, 'Name', dataName);

where time contains the non-uniform sampling time vector. 其中time包含非均匀采样时间向量。 However, I couldn't find any linear or nonlinear model on MATLAB that accepts such kind of non-uniform data. 但是,我在MATLAB上找不到任何可以接受这种非均匀数据的线性或非线性模型。

I would appreciate if anyone could give any hints. 如果有人可以提供任何提示,我将不胜感激。

The support of irregular sampled data in the system identification toolbox is quite limited. 系统识别工具箱中对不规则采样数据的支持非常有限。 Many functions of the System Identification Toolbox require regularly sampled data see this link . 系统识别工具箱的许多功能需要定期采样的数据, 请参阅此链接

From your use of iddata() I guess that your input & output data are measured pairwise at the same moment, but the timespan between adjacent samples is not regular. 根据对iddata()使用,我猜想您的输入和输出数据是同时成对测量的,但是相邻样本之间的时间间隔不是固定的。

In this case you can use some (linear) interpolation eg with interp1 . 在这种情况下,您可以使用一些(线性)插值,例如interp1 This can introduce some errors in the estimation, but it is a simple and fast approach. 这可能会在估算中引入一些误差,但这是一种简单而快速的方法。 Just define the new time grid with regularly time steps and interpolate them. 只需使用定期的时间步长定义新的时间网格并进行插值即可。

% create some dummy data
time = rand(20,1);                                  % irregular sampled measurements
input = sin( 2*pi*time);                            % some input signal
output = cos( 2*pi*time );                          % some output signal

% define new time vector and interpolate input and output data
Ts = 0.01;                                          % new sampling time in seconds
newTime = min(time) : Ts : max(time);               % new time vector
inputInterp = interp1( time, input, newTime  )      % interpolated  input data
outputInterp = interp1( time, output, newTime  )    % interpolated  output data

% lets see what just happend
figure
plot( time,input,'o'), hold on
plot(time,output,'ro');

plot( newTime, inputInterp, 'x')
plot( newTime, outputInterp, 'rx')

legend({'Original Input', 'Original Output', 'Interpolated Input', 'Interpolated Output'})

should do the trick. 应该可以。

The errors should be small if your (original) sampling frequency is larger than the frequency of the relevant dynamics. 如果您的(原始)采样频率大于相关动态的频率,则误差应该很小。 The (rigid body) dynamics of a quadrocopter are in the order of 1 Hz, so measuring the input and output data at 50 or 100 Hz is usually fine (but this may depend on your application). 直升机的(刚体)动力学大约为1 Hz,因此通常可以在50或100 Hz下测量输入和输出数据(但这可能取决于您的应用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM