Contents
DEMO2
Demonstration script for various analyses of a time signal from a tracked vehicle. The script produces one window with four plots, with
- Compressed time data
- Amplitude probability density function (APD)
- Frame statistics of RMS as a function of frame (for stationarity check)
- Power spectral density (PSD)
% Copyright (c) 2003-2006, Axiom EduTech AB, Ljusterö, Sweden. All rights reserved. % URL: http://www.vibratools.com Email: info@vibratools.com
Initialize Variable
FontSize=8;
Load Data
First, load the data
load demo2data;
Time Plot
In the first quadrant of a four-quadrant window, plot the time signal. The command sigtrunc ensures that the data is correcly visualized on the limited screen resolution
fs = round(1/headdx(Header));
x = sigtrunc(Data,fs,0,72);
[xp,tp] = signpack(x,fs,20);
%
Amplitude Probability Density
Next, compute the statistical probability density, and plot it together with a theoretical normal (Gaussian) distribution. (Indeed, the current data are not from a stationary random process. Actually, they are from a periodic signal from a tracked vehicle.)
[a,n,ax] = apdnorm(x,101,-300,300);
%
Frame Statistics
Before computing a PSD of the signal, we should check the stationarity, so we compute frame statistics of the standard deviation
[s,ts] = framstat(x,fs,'std',4000,1000); %
Power Spectral Density
Finally, we compute a PSD of our signal using a block size of 8192 samples, 50% overlap processing, and Hanning window (the latter two settings are not needed to input to the command).
[P,f] = psdnorm(x,fs,8192);
Plot All Results
figure(1);clf;%fullscrn subplot(2,2,1); plot(tp,xp,'k') axis([0 70 -300 300]) xlabel('Time [s]','FontSize',FontSize); ylabel('Acceleration [m/s^2]','FontSize',FontSize) title('Time History','FontSize',FontSize) subplot(2,2,2) semilogy(ax,a,'k') hold on semilogy(ax,n,'r') axis([-300 300 1.e-6 0.02]) xlabel('Amplitude [m/s^2]','FontSize',FontSize) ylabel('Probability Density [s^2/m]','FontSize',FontSize) title('Amplitude Probability Density Compared with Normal','FontSize',FontSize) subplot(2,2,3) plot(ts,s,'k') axis([0 70 0 80]) xlabel('Time [s]','FontSize',FontSize) ylabel('[m/s^2]','FontSize',FontSize) title('Running RMS in 1 Second Intervals','FontSize',FontSize) subplot(2,2,4) loglog(f,P,'k') axis([1 1000 0.001 100]) xlabel('Frequency [Hz]','FontSize',FontSize) ylabel('PSD [(m/s^2)^2/Hz]','FontSize',FontSize) title('Power Spectral Density','FontSize',FontSize) drawnow