Non-linear Curve Fitting Issue with Experimental Data
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aaryan Oberoi
le 24 Fév 2021
Commenté : Mathieu NOE
le 9 Mar 2021
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 commentaires
Réponse acceptée
Mathieu NOE
le 25 Fév 2021
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!