2016-09-27 82 views
0

我想用MATLAB的系統識別工具箱(App)和命令行來識別我的quadcopter的模型。我有輸入和輸出信號都是非均勻採樣,具體來說,連續測量之間的採樣時間在整個實驗中不是恆定的。非均勻(不規則)採樣數據的系統識別

我發現,有可能創建使用MATLAB的非均勻數據集:

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

time其中包含非均勻的採樣時間矢量。但是,我無法在MATLAB上找到任何接受這種非均勻數據的線性或非線性模型。

如果有人能提供任何提示,我將不勝感激。

+0

你不是真的提供了很多關於你試圖建模的數據的信息...... – Trogdor

+0

嗯,我不認爲數據的類型是重要的,但我的輸入數據是一個4 PWM (脈衝寬度調製)在每次採樣時發送給4個電機,並且我的輸出數據是描述四軸飛行器姿態的每個採樣時刻的歐拉角集。 –

回答

0

在系統識別工具箱中對不規則採樣數據的支持是非常有限的。系統識別工具箱的許多功能都需要定期採樣數據see this link

從你使用iddata()我猜你輸入的數據是在同一時刻成對測量的,但是相鄰樣本之間的時間間隔不規則。

在這種情況下,您可以使用一些(線性)插值,例如interp1。這可能會在估計中引入一些錯誤,但這是一種簡單而快速的方法。只需定期定義時間步長並插入它們即可。

% 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'}) 

應該這樣做。

如果您的(原始)採樣頻率大於相關動態的頻率,則誤差應該很小。直升機的(剛體)動力學約爲1 Hz,所以在50或100 Hz下測量輸入和輸出數據通常很好(但這可能取決於您的應用)。