Curve fitting of growing measurement data set

1 visualización (últimos 30 días)
Dorothee Boegler
Dorothee Boegler el 22 de Abr. de 2021
Comentada: Mathieu NOE el 26 de Abr. de 2021
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?

Respuesta aceptada

Matt J
Matt J el 22 de Abr. de 2021
  1 comentario
Dorothee Boegler
Dorothee Boegler el 26 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (1)

Mathieu NOE
Mathieu NOE el 22 de Abr. de 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 comentarios
Dorothee Boegler
Dorothee Boegler el 26 de Abr. de 2021
Thank you! I will adopt the animated plot simulating data acquisition method. This is much more elegant than my previous code.
Mathieu NOE
Mathieu NOE el 26 de Abr. de 2021
Glad it helped !

Iniciar sesión para comentar.

Categorías

Más información sobre Fit Postprocessing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by