matlab拟合结果为x=0的一条直线 10
其中year=1985:2003consumption=21.5522.2122.6723.32823.7724.1724.1924.4224.3424.8625.272...
其中year=1985:2003
consumption=21.55 22.21 22.67 23.328 23.77 24.17 24.19 24.42 24.34 24.86 25.27 25.82 26.50 26.65 27.24 27.55 27.71 27.97 28.51]
说错了,是y=0 展开
consumption=21.55 22.21 22.67 23.328 23.77 24.17 24.19 24.42 24.34 24.86 25.27 25.82 26.50 26.65 27.24 27.55 27.71 27.97 28.51]
说错了,是y=0 展开
1个回答
展开全部
>> year = 1985:2003;
consumption=[21.55 22.21 22.67 23.328 23.77 24.17 24.19...
24.42 24.34 24.86 25.27 25.82 26.50 26.65 27.24 27.55...
27.71 27.97 28.51];
p = polyfit(year,consumption,1);
y = polyval(p,year);
hold on;
plot(year,consumption,'bo');
plot(year,y,'r-');
hold off;
f = poly2sym(p);
y0 = fix(solve(f))
y0 =
1924
consumption=[21.55 22.21 22.67 23.328 23.77 24.17 24.19...
24.42 24.34 24.86 25.27 25.82 26.50 26.65 27.24 27.55...
27.71 27.97 28.51];
p = polyfit(year,consumption,1);
y = polyval(p,year);
hold on;
plot(year,consumption,'bo');
plot(year,y,'r-');
hold off;
f = poly2sym(p);
y0 = fix(solve(f))
y0 =
1924
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询