Curve fitting of growing measurement data set

조회 수: 1 (최근 30일)
Dorothee Boegler
Dorothee Boegler 2021년 4월 22일
댓글: Mathieu NOE 2021년 4월 26일
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.
Mathieu NOE
Mathieu NOE 2021년 4월 26일
Glad it helped !

댓글을 달려면 로그인하십시오.

카테고리

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