How to fit to data

1 vue (au cours des 30 derniers jours)
Qili Hu
Qili Hu le 23 Déc 2019
Commenté : Qili Hu le 24 Déc 2019
h=[0 0 0 0 0.03131 0.06654 0.11742 0.22701 0.3816 0.54012 0.67906 0.76712 0.85127 0.88845 0.91977 0.94912 0.96086 0.9726 0.98043 0.99022 0.99609 1 1];
k=[0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110];
kk=k';
hh=h';
F=@(q,x)q(1)-1/q(2)*(-1+1./x(:,2)+2*log(-1+1./x(:,2))-1./(-1+1./x(:,2)))-x(:,1)
x=[kk hh];
q0=[40 0.4000];
warning off
q=nlinfit(x,zeros(size(x,1),1),F,q0);
disp('k a分别为')
disp(num2str(q));
plot(x(:,1),x(:,2),'ro');
hold on;
ezplot(@(x,y)F(q,[x,y]),[0 120 0 1]);
  2 commentaires
Image Analyst
Image Analyst le 23 Déc 2019
What is x and what is y? Several of your h are the same as neighboring elements. That could be a problem. Try making them not the same. It looks like you're wanting to fit a sigmoid curve.
0000 Screenshot.png
Qili Hu
Qili Hu le 24 Déc 2019
Thanks for your response. The above code is come from the Internet. In fact, I want to fit a sigmoid curve. I want to fit the above data using the implicit function: a-(1/k)*(-1+1/k+2*ln(-1+1/k)-1/(-1+1/x))-t=0 (a and k are the parameters to be calculated, x is as a function of t). But I do not know how to edit program code. Can you help me address this problem? Thank you very much!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Least Squares dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by