fit these curves and what type of fit they are?
1 次查看(过去 30 天)
显示 更早的评论
Coryn Melissa LLamoza Carabali
2020-11-25
评论: Coryn Melissa LLamoza Carabali
2020-11-26
Hi, everybody. Can anyone help me with the fitting of this curves? i think is linear fuction and log/exponetial but I'm not sure.
Here under the code that I'm using... also the documents neeeded for each letter if it's usefull.
Thank you so much in advance!!
A=wdth_2mm;
a_m=mean(A);
a_=std(A);
B=wdth_3mm;
B(B<0)=0;
B(isnan(B))=0;
b_m=mean(B);
b_=std(B);
C=wdth_4mm;
c_m=mean(C);
c_=std(C);
D=wdth_6mm;
d_m=mean(D);
d_=std(D);
E=wdth_8mm;
e_m=mean(E);
e_=std(E);
F=wdth_10mm;
F(F<0)=0;
F(isnan(F))=0;
f_m=mean(F);
f_=std(F);
G=wdth_17mm_new400;
g_m=mean(G);
g_=std(G);
H=wdth_20mm;
h_m=mean(H);
h_=std(H);
mean_wdt=[a_m b_m c_m d_m e_m f_m g_m h_m];
err=[a_ b_ c_ d_ e_ f_ g_ h_];
x_fiber=[2 3 4 6 8 10 17 20];
f_fiber=fit(x_fiber.',mean_wdt.','Exp1');%I try this one but I'm not sure is even exponential
figure(3);
errorbar(x_fiber,mean_wdt,err,'-s','MarkerSize',5,...
'MarkerEdgeColor','red','MarkerFaceColor','red');
xlabel('Fiber lenght(mm)');
ylabel('Width of correlation peak')
title('correlation at different fiber lenghts');
axis([0,22,0,0.015]);
hold on
plot(f_fiber,x_fiber,mean_wdt);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428453/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428458/image.png)
0 个评论
采纳的回答
John D'Errico
2020-11-26
Your data is noisy. There is NO specific function that describes the data. It is NOT truly linear. It is NOT truly exponential, because once the data becomes corrupted with noise, it has lots of other sources of stuff happening.
Those functional forms MAY approximate the data, In fact, they may be reasonable. Or not. It is easy enough to pose infinitely many other model forms that will fit all of those sets of data equally well.
So just pick a model and be happy. Just don't claim the model is correct. It is not.
3 个评论
John D'Errico
2020-11-26
Honestly, I'd probably first try a low order polynomial from what I have seen of your data. So let me try a couple of fits, just to see what seems reasonable. The most obvious would be a variation of exponential, by adding a constant term. You need the constant offset here, as exp1 would fail miserably.
ft = fittype('a + b*exp(-c*x)','indep','x');
mdlexp = fit(x_fiber',mean_wdt',ft,'weight',1./err,'start',[.001,.001,.1])
mdlexp =
General model:
mdlexp(x) = a + b*exp(-c*x)
Coefficients (with 95% confidence bounds):
a = 0.001068 (0.0006595, 0.001476)
b = 0.01474 (0.009451, 0.02004)
c = 0.2908 (0.1831, 0.3984)
If you don't provide an intelligent set of starting values for an exponential model, expect crapola for a result.
errorbar(x_fiber,mean_wdt,err,'-s','MarkerSize',5,...
'MarkerEdgeColor','red','MarkerFaceColor','red');
xlabel('Fiber lenght(mm)');
ylabel('Width of correlation peak')
title('correlation at different fiber lenghts');
hold on
plot(mdl)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428588/image.jpeg)
It could be worse.
format long g
mdlexp.a
ans =
0.00106771635344133
mdlexp.b
ans =
0.0147442104805044
mdlexp.c
ans =
0.290764903016074
Is that the correct model? Who knows?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!