Non-linear Curve Fitting Issue with Experimental Data

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 个评论

If the decay is exponential, why use a power law model? Why not fit with an exponential model?
Because the exponential will not capture the slower decay function.

请先登录,再进行评论。

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File 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