My question relates to signal processing.

Hello everyone. I am new to data preprocessing/processing in Matlab. I have a data set collected from a milling experiment at a sampling rate of 100kHz. The tool used for machining was of diameter 0.5 mm and had two cutting edge. The spindle speed was 57296 rpm. During the experiment, feed was varied seven times. How can I clean and visualize data (see the transition from one feed to the other), and also be able to extract the numerical force values related to each feed value? Below is the link to one of the dataset from the experiment. Thank you in advance!

1 Comment

@ELLY. You can use findchangepts to find the machining segment and extract the segment by extractsigroi function. To analyze the time-varying signal, you can use Time-Frequency analysis method.

Sign in to comment.

 Accepted Answer

Star Strider
Star Strider about 10 hours ago
It would help to know when the different feeds occurred. It's impossible for me to determaine anything from the data alone.
What am I looing at here?
.

13 Comments

@Star Strider thanks for your response. Unfortunately, I dont have the feed change instances but my supervisor says that if I extract the machining region from the signal and clean the data well I should be able to see the various feed instances in the time domain plot or the time-frequency plot, especially in the resultant plot. The machining region is in the 2-3 seconds range in the time domain that you have plotted.
@Star StriderAt the end of the day I should have a plot similar to the one below. In my case the feed was changed 7 times
Hi @ELLY, you will still need to provide the properties or unique indicators of the feed change in the 2-3 seconds time window, so that you can "tell" MATLAB to identify those indicators in the resultant force plot.
Since the feed was varied 7 times, you should probably be looking for 7 distinct shifts in the moving average or moving root mean square (RMS) values rather than looking at individual raw data points. In other words, you need to define specific numerical characteristics to identify the exact moments those 7 shifts happen.
From the math, a sampling rate of 100 kHz is technically much faster than a rotational machining speed of 57,296 rpm, which equals about 955 revolutions per second (57,296 divided by 60 seconds). That means you can capture roughly 105 data samples for every single full rotation of the spindle (100k / 955).
My pleasure!
I do not understand 'extract the machining region from the signal' especially since I do not understand what the 'machining region' refers to. I lowpass-filtered your data (cutoff frequency 250 Hz), and I cannot derive anything that corresponds to the plot in your earlier Comment. (I get a square pulse from about 2 s to 2.5 s. That's it.) How did you derive that information?
But wait, @ELLY. If this were a completely blind experiment in which you entered the machining lab without any instruction sheets, you would not have known the number 7 at all, correct? Did your supervisor tell you that? How did your supervisor know that there had been 7 feed-rate changes without examining the data and counting the steps, as shown in the plot in your earlier Comment?
Is it possible to recover the exact historical timestamps from the machine controller logs?
@Sam Chak, Thank you for your reply. I am the one who designed the experiment with seven feed instances and the initial plan was to make seven experiments (7 runs) but later in the lab we decided to change the feeds under one experiment. The CNC programming was done by someone else who is currently not reachable due to summer holidays. I wanted to know if there is a way one could visualize and possibly determine the force values in the 7 instances without necessarily relying on timestamps from the controller
@Star Strider the plot I posted was from a previous publication that had used the same design of experiment like the one I adopted. However, they don't explain in the paper how they were able to come up with the plot, and that is why I brought it to this forum. Maybe as you said before, I have to look for the timestamps.
'I wanted to know if there is a way one could visualize and possibly determine the force values in the 7 instances without necessarily relying on timestamps from the controller'
If the data in the file you posted is all the information you have, I doubt that what you want to do is possible. I cannot recover the stepwise result you posted in your earlier Comment from the available data in that file. I still do not know how you got that result. Also, the stepwise plot appears to be about 14 s long (with about 13 s of non-zero data) and the data in the posted file is only 10 s long.
Some data -- or significantly relevant information -- appear to be missing.
@Star Strider the stepwise plot I posted was an example of what I am suppose to get after working on the data in the posted file. The plot for the posted file might not be exactly the same but atleast I should be able to separate the 7 regions
Even if I filter those data with a 25 Hz cutoff frequency (the lowest possible cutoff frequency without distorting the signal), I cannot recover the stepwise result --
This is the best I can do with your data.
Also, the code I used to get these --
clear all
close all
RF = readtable("raw_force.txt");
VR = RF.Properties.VariableNames;
figure
tiledlayout(4,1)
for k = 1:4
nexttile
plot(RF.Time, RF{:,k+1})
grid
xlabel(VR{1})
ylabel(VR{k+1})
end
sgtitle('raw\_force.txt')
[FTs1,Fv] = FFT1(RF{:,2:end},RF.Time);
figure
tiledlayout(4,1)
for k = 1:4
nexttile
plot(Fv, abs(FTs1(:,k)), LineWidth=2)
grid
xlim([-100 1.75E+4])
% xlim('padded')
xlabel('Frequency (Hz)')
ylabel(VR{k+1})
end
sgtitle('Fourier Transform of raw\_force.txt')
Ts = mean(diff(RF.(1)));
Fs = 1/Ts;
Fco = 25;
ResForce_Filt = lowpass(RF{:,2:5}, Fco, Fs, ImpulseResponse='iir');
figure
tiledlayout(4,1)
for k = 1:4
nexttile
plot(RF.Time, ResForce_Filt(:,k))
grid
xlabel(VR{1})
ylabel(VR{k+1})
end
sgtitle(sprintf('Lowpass Filtered raw\\_force.txt, F_{co} = %.1f Hz',Fco))
function [FTs1,Fv] = FFT1(s,t)
% One-Sided Numerical Fourier Transform
% Arguments:
% s: Signal Vector Or Matrix
% t: Associated Time Vector
t = t(:);
L = numel(t);
if size(s,2) == L
s = s.';
end
Fs = 1/mean(diff(t));
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTs = fft((s - mean(s)) .* hann(L).*ones(1,size(s,2)), NFFT)/sum(hann(L));
Fv = Fs*(0:(NFFT/2))/NFFT;
% Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
Fv = Fv(:);
FTs1 = FTs(Iv,:);
end
This is the best I can do. The stepwise information you want cannot be recovered from your data, or at least the data in the initially-provided file.
.
@Star Strider thank you for your reply and for the code. I believe I will learn something from your efforts
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
I believe that @Star Strider has done a very good job on the lowpass-filtering of the measured signals. Because data won't lie, if you look carefully on the filtered data of Fx, you can observe 4 peaks and 3 troughs. I believe that these are the strong indicators of the 7 feed changes.
In milling, the force is never distributed equally across all three axes. It is heavily dictated by the direction the machine table is moving. The most likely reason Fx is prominent is that your primary feed motion was programmed along the X-axis of the machine. If your machining tool was moving sideways along the X-axis to cut a slot or a pocket, the sensor's X-channel will directly capture this massive resistance. When the feed rate increases, the resistance along that specific axis jumps drastically, making it the cleanest channel for your 7 indicators.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 25 Aug 2026 at 9:31

Commented:

on 25 Aug 2026 at 19:50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!