How to fit to data

조회 수: 1 (최근 30일)
Qili Hu
Qili Hu 2019년 12월 23일
댓글: Qili Hu 2019년 12월 24일
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
Image Analyst
Image Analyst 2019년 12월 23일
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 2019년 12월 24일
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!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by