[英]How to write data from the accelerometer sensor on a file and write on matlab?
[英]How to calculate speed from sensor data?
我已经从“失齿”传感器获得了用于速度测量的数据。 有什么办法可以得到速度与时间的瞬时关系图? 我可以通过计算零交叉点的数量来获得测量的平均速度,该零交叉点表示传感器齿轮中的“缺齿”,但是我对查看时间历史图更感兴趣。 提前致谢。
% 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.
您可以通过将频率乘以齿之间的距离来将齿频率转换为速度。 滤波器可能有助于消除(采样)噪声。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.