This tutorial will show you how to get started with processing and analyzing your operational measurement data in the VIBES Toolbox.

## Getting started

We will start by converting the data from the operational measurement, in this case, an Electric Wide-Open-Throttle (ELWOT) measurement on a BMW i3, to a `vibes.TimeSeries`

object for easy analysis.

The measurement is imported from a PAK2Mat file format using the static constructor `vibes.TimeSeries.fromPak`

, which extracts a lot of channel and metadata fields that describe the actual time data array.

fn = vibes.fullfile('VIBES,Examples,Datasets','pak','i3Measurement.mat'); TS = vibes.TimeSeries.fromPak(fn);

## Inspecting the TimeSeries objects

The `vibes.TimeSeries`

object has three channels. You can inspect the channels and plot the data directly using the methods of the `vibes.TimeSeries`

class.

TS.listChannels(); % The measurement was performed with a sampling frequency of 48 kHz over a % time of 32.3 seconds. disp(TS.fs), disp(TS.Time(end))

There is a method for plotting the data directly, as well as for plotting (A-weighted) sum levels of the time data. We will plot for the third channel, which is the sound pressure measured in the cabin, and use A-weighting to get correct dB(A) peak levels.

vibes.figure('Time Series') subplot(2,1,1); TS.plot(3); % Apply A-weighting and set scaling to dB(A) subplot(2,1,2); TS.plotSumLevel(3,[],'Weighting','A','YScale','dB');

## Converting to TimeBlocks

Before converting to the frequency domain, we will convert the `vibes.TimeSeries`

object to a `vibes.TimeBlocks`

object. We will use blocks of 0.25 seconds in length, starting 0.1 seconds apart. This means the overlap factor is 2.5x. We use the complete time interval.

time = []; length = 0.25; overlap = 2.5; % Create time blocks TB = TS.toTimeBlocks(time,length,overlap); % Check the first blocks and verify the 0.1 second intervals TB.Blocks(1:5) % You can plot both acceleration channels in one figure using the following % channel selection: ch = TB.Channels.select('Quantity','Acceleration'); % Plot a time block; the labels are provided automatically vibes.figure('Time Blocks: Acceleration'); TB.plot(ch,31); legend location NE

## Converting to FreqBlocks

Converting to the frequency domain means calculating a Fourier transform by means of FFT. The parameters for the FFT operation may have a high impact on the validity of the resulting spectra, which will be shown in this section.

We will first use a Hann window and default FFT settings.

wdw = 'hann'; % Create with default FFT settings based on the block length FB = TB.toFreqBlocks(wdw);

Create a waterfall diagram for quick inspection using the `vibes.FreqBlocks/plot3d`

method. Note that this method is not as configurable as the `vibes.FreqBlocks/plot`

method, which will be demonstrated later.

vibes.figure('Frequency Blocks: Waterfall diagram'); FB.plot3d(); % Adjust the axis of the color bar caxis([40 80]);

## Vary FFT settings, block length, overlap

Let us now investigate the effect of block length, overlap and zero-padding. We focus on a single time block at 10.3 seconds.

b_vmax = '10.3sec'; % Create spectra with 1 Hz frequency spacing, adjusting the effective % block length to 1 second. This results in so-called zero-padding. df = 1; FB_1Hz = TB.toFreqBlocks(wdw,0:df:16000); % Also create spectra with 10 Hz frequency spacing. Observe the warning % that is thrown about negative zero-padding. df = 10; FB_10Hz = TB.toFreqBlocks(wdw,0:df:16000); frq = [4500 5000]; % Define a single parameterised label using the '<...>' elements to reference % to the fields in obj.Parameters.* and obj.* lbl = 'Hz spacing (ZP-factor x)'; vibes.figure('Frequency Blocks: Spectra'); clf FB.plot(1,b_vmax,frq,'Label',lbl,'Style','2k--'); hold on FB_1Hz.plot(1,b_vmax,frq,'Label',lbl,'Style','1b'); FB_10Hz.plot(1,b_vmax,frq,'Label',lbl,'Style','1r');

## Sum level comparison

Notice how the zero-padding factors > 1 result in correct amplitudes, while the 10Hz spacing underestimates the amplitudes. This is because the first two use the full-time blocks for the FFT operation with respectively no padding and 3x padding, while the third setting forces the FFT to be computed for cut-off blocks at 40% of the length.

Now plot sum levels for a selected frequency region to see how this would have affected the estimation.

frq_sum = [4650 4725]; FB.plot(1,b_vmax,frq_sum,'PlotType','sum','Style','2k--'); FB_1Hz.plot(1,b_vmax,frq_sum,'PlotType','sum','Style','1b'); FB_10Hz.plot(1,b_vmax,frq_sum,'PlotType','sum','Style','1r');