Nic*_*sen 8 data-mining numerical-analysis
我最近发射了一种带有气压高度计的火箭,精确到大约10英尺(通过飞行期间获得的数据计算).记录的数据是每个样本0.05秒的时间增量,高度与时间的关系图看起来非常像在整个飞行过程中缩小.
问题是当我尝试从数据中计算其他值(如速度或加速度)时,测量的准确性使得计算值几乎毫无价值.我可以使用哪些技术来平滑数据,以便计算(或近似)速度和加速度的合理值?重要的是,重大事件应及时保持到位,最明显的是第一次进入的0和飞行期间的最高点(2707).
高度数据遵循并以英尺高于地面水平测量.第一次为0.00,每个样品在前一个样品后0.05秒.飞行开始时的尖峰是由于在升空期间发生的技术问题并且去除尖峰是最佳的.
我最初尝试使用线性插值,对附近的数据点求平均值,但是需要多次迭代才能使数据平滑到足以进行积分,并且曲线的平坦化消除了重要的远地点和地平面事件.
非常感谢所有帮助.请注意,这不是完整的数据集,我正在寻找有关更好的数据分析方法的建议,而不是有人回复转换后的数据集.在未来的火箭上使用算法会很好,它可以在不知道完整的飞行数据的情况下预测当前的高度/速度/加速度,尽管这不是必需的.
00000
00000
00000
00076
00229
00095
00057
00038
00048
00057
00057
00076
00086
00095
00105
00114
00124
00133
00152
00152
00171
00190
00200
00219
00229
00248
00267
00277
00286
00305
00334
00343
00363
00363
00382
00382
00401
00420
00440
00459
00469
00488
00517
00527
00546
00565
00585
00613
00633
00652
00671
00691
00710
00729
00759
00778
00798
00817
00837
00856
00885
00904
00924
00944
00963
00983
01002
01022
01041
01061
01080
01100
01120
01139
01149
01169
01179
01198
01218
01238
01257
01277
01297
01317
01327
01346
01356
01376
01396
01415
01425
01445
01465
01475
01495
01515
01525
01545
01554
01574
01594
01614
01614
01634
01654
01664
01674
01694
01714
01724
01734
01754
01764
01774
01794
01804
01814
01834
01844
01854
01874
01884
01894
01914
01924
01934
01954
01954
01975
01995
01995
02015
02015
02035
02045
02055
02075
02075
02096
02096
02116
02126
02136
02146
02156
02167
02177
02187
02197
02207
02217
02227
02237
02237
02258
02268
02278
02278
02298
02298
02319
02319
02319
02339
02349
02359
02359
02370
02380
02380
02400
02400
01914
02319
02420
02482
02523
02461
02502
02543
02564
02595
02625
02666
02707
02646
02605
02605
02584
02574
02543
02543
02543
02543
02543
02543
02554
02543
02554
02554
02554
02554
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02543
02533
02543
02543
02543
02543
02543
02543
02543
02543
02533
02523
02523
02523
02523
02523
02523
02523
02523
02543
02523
02523
02523
02523
02523
02523
02523
02523
02513
02513
02502
02502
02492
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02482
02472
02472
02472
02461
02461
02461
02461
02451
02451
02451
02461
02461
02451
02451
02451
02451
02451
02451
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02441
02431
02441
02431
02441
02431
02420
02431
02420
02420
02420
02420
02420
02420
02420
02420
02420
02420
02420
02420
02410
02420
02410
02410
02410
02410
02400
02400
02410
02400
02400
02400
02400
02400
02400
02400
02400
02400
02400
02400
02400
02390
02390
02390
02380
02380
02380
02380
02380
02380
02380
02380
02380
02380
02380
02380
02380
02370
02370
02380
02370
02359
02359
02359
02359
02359
02359
02359
02359
02359
02359
02359
02359
02359
02359
02349
02349
02349
02349
02349
02339
02339
02339
02339
02339
02339
02339
02339
02339
02339
02339
02339
02339
Run Code Online (Sandbox Code Playgroud)
这是我的解决方案,使用卡尔曼滤波器.如果您想要或多或少地平滑,您将需要调整参数(甚至+ - 数量级).
#!/usr/bin/env octave
% Kalman filter to smooth measures of altitude and estimate
% speed and acceleration. The continuous time model is more or less as follows:
% derivative of altitude := speed
% derivative of speed := acceleration
% acceleration is a Wiener process
%------------------------------------------------------------
% Discretization of the continuous-time linear system
%
% d |x| | 0 1 0 | |x|
% --- |v| = | 0 0 1 | |v| + "noise"
% dt |a| | 0 0 0 | |a|
%
% y = [1 0 0] |x| + "measurement noise"
% |v|
% |a|
%
st = 0.05; % Sampling time
A = [1 st st^2/2;
0 1 st ;
0 0 1];
C = [1 0 0];
%------------------------------------------------------------
% Fine-tune these parameters! (in particular qa and R)
% The acceleration follows a "random walk". The greater is the variance qa,
% the more "reactive" the system is expected to be, i.e.
% the more the acceleration is expected to vary
% The greater is R, the more noisy is your measurement instrument
% (less "accuracy" of the barometric altimeter);
% if you increase R, you will smooth the estimate more
qx = 1.0; % Variance of model noise for position
qv = 1.0; % Variance of model noise for speed
qa = 50.0; % Variance of model noise for acceleration
Q = diag([qx, qv, qa]);
R = 100.0; % Variance of measurement noise
% (10^2, if 10ft is the standard deviation)
load data.txt % Put your measures in this file
est_position = zeros(length(data), 1);
est_speed = zeros(length(data), 1);
est_acceleration = zeros(length(data), 1);
%------------------------------------------------------------
% Kalman filter
xhat = [0;0;0]; % Initial estimate
P = zeros(3,3); % Initial error variance
for i=1:length(data),
y = data(i);
xpred = A*xhat; % Prediction
Ppred = A*P*A' + Q; % Prediction error variance
Lambdainv = 1/(C*Ppred*C' + R);
xhat = xpred + Ppred*C'*Lambdainv*(y - C*xpred); % Update estimation
P = Ppred - Ppred*C'*Lambdainv*C*Ppred; % Update estimation error variance
est_position(i) = xhat(1);
est_speed(i) = xhat(2);
est_acceleration(i) = xhat(3);
end
%------------------------------------------------------------
% Plot
figure(1);
hold on;
plot(data, 'k'); % Black: real data
plot(est_position, 'b'); % Blue: estimated position
plot(est_speed, 'g'); % Green: estimated speed
plot(est_acceleration, 'r'); % Red: estimated acceleration
pause
Run Code Online (Sandbox Code Playgroud)