signal drift when integrating accelometer data to velocity
2 views (last 30 days)
Show older comments
Hi all,
I am generating some synthetic accelerometer data with noise to perform a modal analysis. I have used a sine wave added noise with a random number added to the amplitude value. I am now trying to "clean" out the noise with a low pass filter and then integrate for velocity, but I am still getting some drift in my velocity wave. I have tried detrend, and that doesn't seem to work. Please see my attached code. Is there something else I can do with my filter? also, is there a better way of generating my accerometer data?
Thanks,
function output=signalgen(a, omega,t)
f=omega*2*pi;
r=normrnd(-1,1,[1,length(t)]);
output=(a+(r./100)).*sin(f.*t);
end
a=input('What is the amplitude of the acceleration? ');
omega=input(' Please specify input frequency: ');
t=0:0.05:100;
%% Initial Signal Generation
%this section generates initial accelometer signals for synthetic data
y1=signalgen(a, omega, t);
%% Signal Cleaning
d = designfilt('lowpassiir','FilterOrder',2, ...
'HalfPowerFrequency',0.15,'DesignMethod','butter');
w1= filtfilt(d, y1);
subplot(2,1,1)
plot(t,w1)
%% integration from acceleration to displacement
q1=cumsum(w1);
q2=detrend(q1);
subplot(2,1,2)
plot(t,q2)
0 Comments
Answers (0)
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!