Curve fitting of growing measurement data set

5 views (last 30 days)
I follow fatigue tests live and record measurement data at defined time intervals. In the end, there is always a curve that can be divided into three areas. See in the picture.
For the various tests, they only differ in terms of the total service life and the gradient in the middle range.
Problem: The complete measurement data can be fitted reasonably well
with a 6th degree polynomial, but this does not work with an incomplete data set.
My question now is: how can I smooth / fit the values ​​during the measurement data acquisition with the boundary condition that a curve of this shape comes out at the end?

Accepted Answer

Matt J
Matt J on 22 Apr 2021
  1 Comment
Dorothee Boegler
Dorothee Boegler on 26 Apr 2021
Thanks! that looks good . I was looking for something like that. Now I have to apply that to my case. But since I'm not that fit with Matlab, it takes a while ... I hope I can manage it that way.

Sign in to comment.

More Answers (1)

Mathieu NOE
Mathieu NOE on 22 Apr 2021
hello
this little code snipset in case it fills your needs
% dummy data
n = 200;
x = 1:n;
y = 1-exp(-x/5);
yf = -fliplr(y)+1;
y = y + yf + 0.0025*x + 0.1 * randn(1,n);
figure(1);
plot(x,y);
hold on
% animated plot simulating data acquisition + smoothing (by polynomial fit)
%// initiallize plot. Get a handle to graphic object
p1 = plot(0,0,'b',0,0,'dr');
title('Data Acquisition')
xlabel('Strain');
ylabel('Force');
axis([0 n 0 3]);%// freeze axes to their final size, to prevent Matlab from rescaling them dynamically
x_acq = []; % init
y_acq = []; % init
for ci = 1:n
% simulate data acquisition and buffer fill
x_acq = [x_acq x(ci)];
y_acq = [y_acq y(ci)];
% poly fit
p = polyfit(x_acq,y_acq,6);
yf = polyval(p,x_acq);
% update the plot
pause(0.05)
set(p1, 'XData', x_acq, 'YData', yf );
end
hold off
  2 Comments
Dorothee Boegler
Dorothee Boegler on 26 Apr 2021
Thank you! I will adopt the animated plot simulating data acquisition method. This is much more elegant than my previous code.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!