Non-linear Curve Fitting Issue with Experimental Data

조회 수: 10 (최근 30일)
Aaryan Oberoi
Aaryan Oberoi 2021년 2월 24일
댓글: Mathieu NOE 2021년 3월 9일
I am using the MATLAB curve fitting tool to fit the following data given in matrices A(:,1) through A(:,7). Data in A(:,1)-A(:,7) are y-axes results while the x-axes, given in matrix B, remains the same for all. I have attached the data as .mat file to this post.
Objective: To fit the data (given A, B in data.mat) with a single function
What I have tried so far: I have used the curve fit to fit the data using power function. Although matric A(:,1)-A(:,4) fit pretty well, I am unable to fit A(:,5)-A(:,7) since they have an exponential decay that is difficult to be captured using power functions. Also, note that the data along the x-axes does not saturate as the x is increased.
Below is an image of the curve fit that I tried and it does not seem to satisfy the fast decaying data given in darker (black) lines in the plot.
Here is the code that I am currently using for reference:
color_array = linspace(1,0,length(VG_array));
for k=1:7
base_floor(min(abs(A(:,k)))<9e-12) = min(abs(A(:,k)));
base_floor(min(abs(A(:,k)))>9e-12) = 0;
semilogy(B,A(:,k),...
'Color',[color_array(k) 0 0]);
hold on;
f = fit( B', A(:,k), 'power1' );
options = fitoptions('power1');
options.Robust = 'Bisquare';
plot(B,(f.a*B.^f.b)+base_floor,'--')
hold on;
parameters_wb_delta(:,k) = f.a;
parameters_wb_gamma(:,k) = f.b;
end
What I need help with: I need a single function fit that can capture all the data in the matrices A(:,1)-A(:,7) with respect to B.
  댓글 수: 2
Matt J
Matt J 2021년 2월 24일
편집: Matt J 2021년 2월 24일
If the decay is exponential, why use a power law model? Why not fit with an exponential model?
Aaryan Oberoi
Aaryan Oberoi 2021년 3월 8일
Because the exponential will not capture the slower decay function.

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

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 2월 25일
HELLO
I don't have the CF Toolbox but I could manage to get a reasonnable good fit by using 4th ordre polynomial fit on log log scale
so the fit function is like : yfit = 10^(poly 4th order)
hope it helps
%
for ci = 1:size(A,2)
Bp = polyfit(log10(B), log10(A(:,ci)), 4);
Yfit_log = polyval(Bp,log10(B));
Yfit(ci,:) =10.^Yfit_log;
end
figure(1),loglog(B,A,B,Yfit, '-.', 'MarkerSize', 10, 'LineWidth', 2)
grid on
  댓글 수: 2
Aaryan Oberoi
Aaryan Oberoi 2021년 3월 8일
This works pretty well. Thanks!
Mathieu NOE
Mathieu NOE 2021년 3월 9일
You're welcome !

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by