How to fit to data
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!