Non-linear Curve Fitting Issue with Experimental Data

16 ビュー (過去 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 Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by