HW 1
HW 1
HW 1
Practice work №1
Processing experimental data in Matlab
Almaty, 2024
CONTENT
Introduction ......................................................................................................................... 3
1. Transform from a large size to a smaller one ..................................................................... 4
2. Data smoothing and noise reduction in time-series data ...................................................... 5
Conclusion .......................................................................................................................... 7
INTRODUCTION
3
1. Transform from a large size to a smaller one
This dataset is a large table with 3 rows. The table is named "vibration_data," so
I assumed that the resulting graph would resemble an oscillation. I wrote the following
code:
% Reading data from .h5 file
data = h5read('M03_Aug_2019_OP00_000.h5', '/vibration_data');
t = (1:length(data(:, 1)))./100; % time array
% Plotting a reduced data set
figure; % Opening a new window for the chart
plot(t, data);
grid on; % Создание сетки на графике
xlabel('Время, с'); % X-axis label
ylabel('Напряжение, мВ'); % Y-axis label
In this code, you can see that I used the pre-built function "h5read" to read the
given format. After running the code, I obtained the plot shown in Figure 1.2.
4
Figure 1.2 – Plotting graphs for each row of data
In this part, I used the method of finding the average and making the graph
smoother. The idea is to reduce noise and fluctuations in the data to see the clear plot.
Here is the code.
% Reading data from the .h5 file
data = h5read('M02_Aug_2019_OP03_009.h5', '/vibration_data');
5
MATLAB function ‘movmean’ returns an array of local k-point mean values,
where each mean is calculated over a sliding window of length k across neighboring
elements of A. After running the code, I obtained the plot shown in Figure 2.1.
Now, you can see the smoothed graphs. There are three graphs, with the first two
signals oscillating around 0, and the other one oscillating around -1000. Filtration is
one of the essential techniques in the automation industry for controlling processes in
a plant. For example, by applying this method, the operator can ensure that the sensor
displays accurate values without fluctuations.
There is another dataset used to train a new model. In this example, the data
represents the top universities in the world. Following the same principle as before,
the graph was plotted and is shown in Figure 2.2.
6
CONCLUSION
In conclusion, MATLAB is a powerful tool that allows for reading large datasets
and training models. In our case, we used vibration data and wrote code to smooth it.
We used built-in functions to read and apply smoothing methods to the datasets.
MATLAB also provides clear presentation of graph plots with multiple colors, which
enhances data visualization. Firstly, the compilation took a long time before the
resulting plot appeared. The reason was that the dataset was slightly large, so it had to
be reduced for further operations. By simplifying all of this, the dataset can be prepared
for machine learning training.