我有一个“缺牙”传感器的数据,可以用来测量速度。有没有办法可以得到速度与时间的瞬变曲线图?我可以通过计算传感器齿轮中指示“缺齿”的过零点的数量来获得测量的平均速度,但我更感兴趣的是查看时间历史曲线图。提前谢谢。
发布于 2017-03-11 20:41:10
% 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.该代码生成以下图:


您可以通过将频率与齿之间的距离相乘来将齿频率转换为速度。滤波器可能对消除(采样)噪声很有用。
https://stackoverflow.com/questions/42687464
复制相似问题