How to determine start and end points of fitting curve?
8 次查看(过去 30 天)
显示 更早的评论
Hi all, I have
x=[0.25 0.50 0.75 1]
y=[0.0001 0.1 0.6889 10]
and I use power(2) to get the fitting curve. Is there a way to determine some points in the fitting curve? Because, when I get my fitting curve equation and use the above data, I get for x=0.25,y = 0.048 which is quite far from 0.00001. Any idea anyone how can I fix this?
0 个评论
回答(1 个)
dpb
2015-12-1
编辑:dpb
2015-12-1
A power model doesn't fit these data worth a hooey at the lower end...try
plot(f,x,y,'*')
set(gca,'yscale','log')
ylim([y(1)/2 y(end)*2])
to see the problem; the curvature is positive for the fitted curve but negative in that region for the actual data. It appears either a 'power1' or linear in both log(x) log(y) would be a better fit of these data than 'power2'.
Addendum
b=polyfit(log(x),log(y),1); % fit log-log
yh=exp(polyval(b,log([x(1) x(end)]))); % Evaluate at end points
hold on
plot([x(1) x(end)],yh,'c') % add to the previous plot
You'll see this is quite a lot closer...but looking at residual errors one finds that the power1 model may be best overall...will leave that as "exercise for the student" :)
1 个评论
dpb
2015-12-1
Oh, which illustrate why one should never curvefit w/o first plotting the data to see what gives...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!