MicrosoftInternetExplorer402DocumentNotSpecified7.8Normal0
%原始数据曲线
t=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22];
y=[4857 4877 4900 4890 4984 4984 6427 10044 10382 12018 13604 14803 16939 16753 18451 18503 19522 19395 21507 21716 21548 21628 22146];
time=1990:1:2012;
plot(time,y,'o');
xlabel('周期数 t (年份:1990年—2012年)');
ylabel('公共电汽车数量(Yi/辆)');
title('公共电汽车数量原始统计数据')
%多项式回归曲线
PF=[ones(size(t)) t t.^2 t.^3];
a=PF\y;
T=(0:1:25)';
Y1=[ones(size(T)) T T.^2 T.^3]*a;
waitforbuttonpress;
clf;
plot(T,Y1,'-',t,y,'o'),grid on
输入后给我提示错误,提示如下:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
%原始数据曲线
t=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22];
y=[4857 4877 4900 4890 4984 4984 6427 10044 10382 12018 13604 14803 16939 16753 18451 18503 19522 19395 21507 21716 21548 21628 22146];
time=1990:1:2012;
plot(time,y,'o');
xlabel('周期数 t (年份:1990年—2012年)');
ylabel('公共电汽车数量(Yi/辆)');
title('公共电汽车数量原始统计数据')
%多项式回归曲线
PF=[ones(size(t)) t t.^2 t.^3];
a=PF\y;
T=(0:1:25)';
Y1=[ones(size(T)) T T.^2 T.^3]*a;
waitforbuttonpress;
clf;
plot(T,Y1,'-',t,y,'o'),grid on
输入后给我提示错误,提示如下:
??? Error using ==> mtimes
Inner matrix dimensions must agree.