如何根据传感器数据计算速度?

时间:2017-03-09 05:29:27

标签: matlab signal-processing sensor

我从失踪的牙齿中获取了数据'传感器用于速度测量。有什么方法可以得到一个速度与时间的短暂情节?我可以通过计算零交叉的数量来获得测量的平均速度,这表示“缺失的牙齿”#39;在传感器设备中,但我对查看时间历史图更感兴趣。 提前致谢。

1 个答案:

答案 0 :(得分:0)

% I will first generate a example sensor output
Ts = 0.001;
t = 0:Ts:10;
freq = linspace(2, 5, length(t)); % increase the tooth frequency from 2Hz to 5Hz.
theta = cumsum(freq*2*pi*Ts);
x = sin(theta);
figure('Name', 'missing tooth sensor') % plot the sensor output
plot(x)

% Now, I will perform the actual calculations.
iCrossings = find(sign(x(1:end-1)) ~= sign(x(2:end))); % finds the crossings
dtCrossing = diff(t(iCrossings)); % calculate the time between the crossings
figure('Name', 'tooth frequency')
hold on
plot(t, freq, 'g'); % plot the real frequency in green
plot(t(iCrossings(1:end-1)), 1./(2*dtCrossing), 'b'); % plot the measured frequency in blue.

代码生成以下数字: enter image description here

enter image description here

您可以通过将频率乘以牙齿之间的距离来将牙齿频率转换为速度。滤波器可用于抵消(采样)噪声。