簡體   English   中英

如何從傳感器數據計算速度?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM