I'm trying to find displacement from acceleration datas

13 ビュー (過去 30 日間)
Claudio Gerosa
Claudio Gerosa 2024 年 4 月 16 日
コメント済み: Star Strider 2024 年 4 月 17 日
Hi, I would like to ask a question about an issue that I'm facing. I'm trying to find the displacement of a vibrating object by integrating some acceleration datas I acquired using a piezoelectric accelerometer. I tried integrating them by using the cumtrapz function twice but the displacement datas that I obtain are pretty weird and very far from the real phenomenon. I'm uploading the two graphs of the acquired acceleration and the displacement to make my issue more clear. Is there something that I'm missing? Thank you in advance for your help.

回答 (1 件)

Star Strider
Star Strider 2024 年 4 月 16 日
Your original ac celeration data have a trend, and you are integrating the trend. Use the detrend function tto remove it (alternatively, use a highpass filter), and the data appears to be much more reasonable.
Try this —
files = dir('*.fig');
for k = 1:numel(files)
fn = files(k).name
F{k} = openfig(fn);
hl{k} = findobj(F{k}, 'Type','line');
x{k,:} = hl{k}.XData;
y{k,:} = hl{k}.YData;
B = [x{k}; ones(size(x{k}))].' \ y{k}.' % Detect Linear Trend
end
fn = 'acceleration.fig'
B = 2x1
0.0711 -0.7792
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
fn = 'displacement.fig'
B = 2x1
-28.2987 42.9890
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
format longG
xstats = [mean(diff(x{1})); std(diff(x{1}))]
xstats = 2x1
1.0e+00 * 7.8125e-05 2.36157660776988e-16
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
format short
[FTs1,Fv] = FFT1(y{1},x{1});
figure
plot(Fv, abs(FTs1)*2)
grid
xlabel('Frequency')
ylabel('Magnitude')
xlim([0 1E+3])
ydt = detrend(y{1}, 1);
vel = cumtrapz(x{1}, ydt);
dspl = cumtrapz(x{1}, vel);
figure
plot(x{1}, vel, 'DisplayName','Velocity')
hold on
plot(x{1}, dspl, 'DisplayName','Displacement')
hold off
grid
xlabel('Time')
ylabel('Amplitude')
legend('Location','best')
function [FTs1,Fv] = FFT1(s,t)
t = t(:);
L = numel(t);
if size(s,2) == L
s = s.';
end
Fs = 1/mean(diff(t));
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTs = fft((s - mean(s)) .* hann(L).*ones(1,size(s,2)), NFFT)/sum(hann(L));
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
FTs1 = FTs(Iv,:);
end
There is a small amount of noise in the data, however it does not appear to affect the result.
.
  2 件のコメント
Claudio Gerosa
Claudio Gerosa 2024 年 4 月 17 日
Thank you for your answer, but still I need more accurate values of instantaneous displacement as I need to calculate elastic force. The displacement of the object i'm examining is probably about a few millimeters, so the values in your graph are still pretty high.
Star Strider
Star Strider 2024 年 4 月 17 日
My pleasure!
My code solves the problem of integrating the offset and trend, and that is all you requested.
Your data are your data, so you may need to re-scale or re-calibrate your initial measurements. I have no control over that.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVibration Analysis についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by