2.2 Dataset classes

The VIBES Toolbox for MATLAB provides several different classes to store, access, and plot measurement and simulation data. All these classes are subclasses of superclass vibes.abstract.Dataset. This tutorial will demonstrate how to construct, modify and convert the different types of datasets. The following classes will be discussed:

  • vibes.TimeSeries
  • vibes.TimeBlocks
  • vibes.FreqBlocks
  • vibes.FRFMatrix

Class hierarchy

See the next figure to gain insight into the hierarchy of the different dataset classes in the VIBES Toolbox.

Class hierarchy

Time series

The most basic dataset class is the vibes.TimeSeries class. This class allows you to import measurement data directly. We will demonstrate this by converting a PAK2Mat file to a vibes.TimeSeries object.

% Locate the PAK2Mat file
fn = vibes.fullfile('VIBES,Examples,Datasets','pak','i3Measurement.mat');

% Call the 'fromPak' constructor of the vibes.TimeSeries class to construct
% an object.
TS = vibes.TimeSeries.fromPak(fn);

Show the object’s properties. Notice the Data property, which contains the actual numeric measurement data, stored as a matrix.

disp(TS)

Any dataset object contains a list of channels, which can be accessed through the Channels property. These channels provide information on your data, such as the units in which they are measured and the direction of the measured response (if applicable).

disp(TS.Channels)

You can use the plot method for any vibes.abstract.Dataset object. This method will automatically apply axis labels based on the definition of the object’s channels. You can specify channel names, indices, or properties to select which channels to plot. For more information about plotting of datasets, see 2.3 Plotting of time data and 2.4 Plotting of spectral data.

% Plot the first 10 seconds of data
TS.plot('Cabin',[0 10])

Plot the first 10 seconds of a dataset

Time blocks

A vibes.TimeSeries object can easily be converted into a vibes.TimeBlocks object, which contains the same data cut into (overlapping) blocks. This introduces an extra dimension to your data. The Data matrix can be indexed according to channel, block, and time indices. For a more detailed tutorial on the parameters used in this conversion, see 3.1 Signal processing: vehicle measurement.

% Define the parameters
time = [];
length = 0.25;
overlap = 2.5;

% Create time blocks
TB = TS.toTimeBlocks(time,length,overlap);

A vibes.TimeBlocks object has an additional property, Blocks. Inspect the list of blocks to see their properties. All blocks have a start time, t1, an end time t2 and an extra field z. You can use this field to store information about your measurement, such as RPM values at specific times.

disp(TB.Blocks)

Plotting vibes.TimeBlocks objects allows you to specify which block to plot. The first three arguments of the plot method are now the channel, block, and time indices in the data matrix respectively.

% Select a block between 10 and 10.5 seconds to plot
b = TB.Blocks.select('t1','>',10.0,'t1','<',10.1);

% Plot the microphone data for that block
TB.plot('Cabin',b,[])

Plotting time blocks

Frequency blocks

The vibes.FreqBlocks class is similar to the vibes.TimeBlocks class, except that it contains frequency data as opposed to time data. vibes.TimeBlocks objects can be converted to frequency blocks by applying the Fast Fourier Transform (FFT). For more information on how to customize this procedure, see 3.1 Signal processing: vehicle measurement.

% Apply Hann window and FFT
FB = TB.toFreqBlocks('hann');

Plotting of frequency blocks happens according to the same indexing as time blocks, except the third argument now refers to the frequency range of interest.

% Plot the same block as before, in a frequency range of 0 to 3000 Hz
FB.plot('Cabin',b,[0 3000])

Plotting frequency blocks

FRF matrix

Some types of datasets describe the transfer of input to output. These types are grouped under superclass vibes.abstract.RefDataset. Their columns are indexed according to the property RefChannels, containing a list of vibes.Channel objects. An example of a reference dataset is the Frequency Response Function Matrix      (vibes.FRFMatrix) class. You can calculate FRF matrices from measurement data by dividing two vibes.FreqBlocks objects to perform a least-squares inversion across all blocks and frequencies.

Define two subsets of the measurement data: the sound channel and the acceleration channels. For more information on selecting channels, see 2.1 Nodes, DoFs and channels.

sound = FB.subs({'Quantity','Sound Pressure'});
acc = FB.subs({'Quantity','Acceleration'});

% Calculate the transmissibility from acceleration to sound pressure
T = sound/acc;

Dataset operations

Many of the basic operations available in MATLAB can be applied to dataset objects. This will be demonstrated by using the FRF matrix of a benchmark structure.

% Load the FRF matrix
Y = vibes.load('VIBES,Examples,Datasets','mat','Benchmark','YABm.FRFMatrix.mat');

% Load time data of the measured response
TS = vibes.load('VIBES,Examples,Datasets','mat','Benchmark','uAB.TimeSeries.mat');

% Calculate spectra with standard settings
u = TS.toTimeBlocks.toFreqBlocks([],Y.Freq);

Now, the forces corresponding to the measured response can be calculated by applying a matrix division to the FRF matrix.

f = Y \ u;

Calculate the partial response corresponding to each force input by applying an element-wise multiplication.

up = Y.*f;

Operations in the VIBES Toolbox are automatically applied to matching channels and reference channels. For example, when multiplying to FRF matrices, the reference channels (columns) of the first object are matched with the channels (rows) of the second object. For more information about automatic and customized DoF-matching, see 2.1 Nodes, DoFs and channels.

Transformation matrices

Apart from applying operations to two dataset objects, it is also possible to transform measurement data using vibes.TransformationMatrix objects. This can be especially useful when applying, for example, a Virtual Point Transformation.

% Define a Virtual Point at the center of the sensor with grouping 1
p_vp = [0 0 0];
types = 1:6;
vp = vibes.VirtualPoint(p_vp,1,types);
vp_ch = vp.toChannel;

% Create a vibes.IDMMatrix object from the virtual point channels
IDM = Y.Channels.createIDMMatrix(vp_ch);

% Use * to transform the measurement data to the virtual point
Yvp = IDM*Y;


    Contact us for more VIBES


    Contact our support team or call us on +31 85 822 50 49

    ×