Curve fitting of growing measurement data set

1 次查看(过去 30 天)
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?

采纳的回答

Matt J
Matt J 2021-4-22
  1 个评论
Dorothee Boegler
Dorothee Boegler 2021-4-26
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.

请先登录,再进行评论。

更多回答(1 个)

Mathieu NOE
Mathieu NOE 2021-4-22
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 个评论
Dorothee Boegler
Dorothee Boegler 2021-4-26
Thank you! I will adopt the animated plot simulating data acquisition method. This is much more elegant than my previous code.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fit Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by