Industrial Datasets Inc. / Matlab Bearing Wear Analysis Audio / Accelerometer Public

Matlab Bearing Wear Analysis Audio / Accelerometer

This is part of the synthetic data generation tutorial set focusing on MATLAB for the bearing wear analysis use case in the Mathworks examples.

About this project

% generate_bearing_data.m

% 1. Basic configuration fs = 1000; % Sampling rate (Hz) t_end = 2; % Duration of each signal (seconds) t = 0:1/fs:t_end-1/fs; % Time vector N = length(t); % Number of samples

% 2. Number of synthetic samples you want numSamples = 50;

% 3. Preallocate a matrix or cell array to hold data allData = cell(numSamples, 1);

% Define a fundamental frequency for the bearing (e.g., rotating speed) f0 = 50; % Hz (example rotating frequency)

% Generate the healthy baseline signal healthySignal = sin(2pif0*t) ... % Primary vibration

            + 0.05 * randn(size(t)); % Small random noise

% Progressive wear parameters wearGrowthRate = 0.02; % Increase in amplitude over time impulseFrequency = 20; % Rate of impulses per second impulseAmplitude = 0.5; % Amplitude of impulses

% Create a vector that grows linearly from 0 to 1 across time wearFactor = linspace(0, 1, N);

% Generate the wear-induced signal (example approach) impulses = zeros(size(t)); for i = 1:N % Randomly trigger impulses if rand < (impulseFrequency/fs) impulses(i) = impulseAmplitude * (0.5 + rand); % random amplitude spikes end end

% Add wear effect: linearly increase amplitude & add impulses wornSignal = (1 + wearFactor wearGrowthRate) . healthySignal + impulses;

% Loop over the number of samples for k = 1:numSamples

% Optional randomization:
% 1. Slightly vary fundamental frequency
f0_rand = f0 + randi([-2, 2]); 

% 2. Re-generate healthy portion
healthySignal = sin(2*pi*f0_rand*t) + 0.05 * randn(size(t));

% 3. Re-generate impulses, etc.
impulses = zeros(size(t));
for i = 1:N
    if rand < (impulseFrequency/fs)
        impulses(i) = impulseAmplitude * (0.5 + rand);
    end
end

% 4. Combine signals
wornSignal = (1 + wearFactor * wearGrowthRate) .* healthySignal + impulses;

% Label can be "bearing_wear" or something more descriptive
label = "bearing_wear";

% Store in cell array
allData{k} = wornSignal;

% (Optional) Plot to visualize
% figure;
% plot(t, wornSignal);
% title(['Synthetic Bearing Signal #', num2str(k)]);
% xlabel('Time (s)');
% ylabel('Amplitude');

% 5. Save each signal as a CSV (one approach)
% Combine time, signal, and label (if you want time + amplitude in a file)
dataToSave = [t' wornSignal'];
csvFilename = ['bearing_wear_', num2str(k), '.csv'];
writematrix(dataToSave, csvFilename);

end

% If you want a single CSV with label in the same file: labelArray = repelem(string(label), N)'; dataToSave = [t' wornSignal' labelArray];

figure; plot(t, allData{1}); title('Example Synthetic Bearing Signal'); xlabel('Time (s)'); ylabel('Amplitude');

normal_0176
rolling_fault_0795
outer_fault_0489
combined_fault_0839
normal_0156
normal_0013
rolling_fault_0616
rolling_fault_0682

Run this model

On any device

Dataset summary

Data collected
4h 52m 58s
Sensor
Amplitude @ 1000Hz
Labels
combined_fault, inner_fault, normal, outer_fault, rolling_fault

Project info

Project ID 618309
License BSD 3-Clause Clear
No. of views 40,344
No. of clones 0