How can I graph several points from a table and extrapolate a curve?
3 次查看(过去 30 天)
显示 更早的评论
I'm somewhat new to MATLAB, although I used it in school. I have a table of x and y-values, and want to plot the points on a graph and then extrapolate a linear curve. Can someone help explain how to do this? I am used to graphing with equations, this is sort of the opposite way around.
0 个评论
采纳的回答
dpb
2013-12-9
Well, poly[fit|val] are "all in Matlab"...
dat=[1500,200; 2500,259; 4530,1980];
plot(dat(:,1),dat(:,2))
p=polyfit(dat(:,1),dat(:,2),1);
yhat=polyval(p,[1000 5000]);
hold on
plot([1000 5000],yhat)
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!