Filter out misalignment of sensor signal
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi,
I have taken measurements with a lasersensor that moves along an axis and takes distance measurements to a wall for each position (1, 2, 3, ...). It seems that the axis that the sensor is mounted on is not perfectly parallel to the wall so that I can see a trend which you can see in the image below. The blue line is my acquired signal, the red lines describe the signal within a measurement position (X number of points for each measurement position).
How can I filter out the misaligned sensor axis and simulate a perfectly aligned axis that is parallel to the wall?
Thanks.

採用された回答
Star Strider
2021 年 7 月 9 日
8 件のコメント
Konvictus177
2021 年 7 月 9 日
Perfectly aligned axis means that I do not see the two peaks in my data. The signal should be flat where the data of the measured positions should be attached to each other without having the two peaks.
Star Strider
2021 年 7 月 9 日
Try the filter approach.
To design the filters correctly, first do a Fourier transform (fft) on the signal to determine the appropriate bandpass or highpass frequencies. The highpass filter will elimiinate the baseline variation only, the bandpass filter will eliminate the baseline variation and high-frequency noise, if that is desiered.
Konvictus177
2021 年 7 月 9 日
編集済み: Konvictus177
2021 年 7 月 10 日
Thanks for the advice but filtering will change the amplitude of the signal a lot. I think that each time the sensor moves to the next measurement position there is a jump/step in the signals which results in the overall trend you can see in the figure above. How do I remove the jump/step for each measurement position? The length of the signal for each measurement position is actually way smaller than shown in the figure. This is only done for illustration purposes. The signal consists of multiple measurements which are attached to each other.

Star Strider
2021 年 7 月 10 日
I will have to have a representative signal to experiment with, and a description of the result you want, in order to proceed.
The filtering approach will likely work, unless the signal itself has low-frequency components that cannot be successfully separated from the baseline variation frequency. Other approaches may work if filtering does not. I cannot determine at present how to solve this, or if a solution is possible.
.
Konvictus177
2021 年 7 月 10 日
編集済み: Konvictus177
2021 年 7 月 10 日
So I actually want to create a surface map of a laying cylindrical object. The data that is attached here is the Z-Height over the entire width for a specific angle (360° full angle).
You can notice the trend resulting from multiple measurements attached to each other. The signal should look more or less flat without steps. Each measured signal consists of 33 data points which are attached to each other to create the full width.
Star Strider
2021 年 7 月 10 日
I am not certain how you calculated the values in the earlier plot image.
I developed this code for you to experiment with to see what works, since I have no idea what information you want in the filtered signal:
LD = load('DataZ.mat');
DataZ = LD.DataZ;
L = numel(DataZ);
x = linspace(0, L-1, L);
figure
plot(x, DataZ)
grid
Fs = 1/x(2);
Fn = Fs/2;
N = 2^nextpow2(L);
DataZm = DataZ-mean(DataZ);
FTDZ = fft(DataZm,N)/L;
Fv = linspace(0, 1, fix(numel(FTDZ)/2)-1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTDZ(Iv))*2)
grid
xlim([0 0.025])
Flo = 6E-3; % Low Frequency Cutoff
Fhi = 1.5E-2; % High Frequency Cutoff
[DataZfilt,DF] = bandpass(DataZ, [Flo Fhi], Fs);
figure
plot(x, DataZfilt)
grid
Please experiment with this — specifically ‘Flo’ and ‘Fhi’ — to see if it produces the result you want (that I still do not have any idea about). It requires the Signal Processing Toolbox and MATLAB 2018a or later. (I can code an equivalent filter if you have an earlier version of the Toolbox.) The first figure is the original signal, the second is the Fourier transform (that can help guide the frequency values for the filter), and the third is the filtered signal.
.
Konvictus177
2021 年 7 月 10 日
Thanks, I will experiment with it a bit and yes, I do have the toolboxes.
Star Strider
2021 年 7 月 10 日
As always, my pleasure!
Out of my own curiosity, I would like to see what the desired result looks like, and the filter frequencies used to derive it.
.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Smoothing and Denoising についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
