Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x0=[3459 3489 3526 3657.2 3714 5454 5967 7432 8212 10938];s=0;for i=1:10 %n=10;s=s+x0(i);x1(i)=sendfor j=1:9 %n-1=9;G(j,1)=-(x1(j+1)+x1(j))/2G(j,2)=1endfor k=1:9Y

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 02:13:18
Errorusing==>mtimesInnermatrixdimensionsmustagree用matlab求解时出现错误x0=[3459348935263657.2371454545967743

Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x0=[3459 3489 3526 3657.2 3714 5454 5967 7432 8212 10938];s=0;for i=1:10 %n=10;s=s+x0(i);x1(i)=sendfor j=1:9 %n-1=9;G(j,1)=-(x1(j+1)+x1(j))/2G(j,2)=1endfor k=1:9Y
Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误
x0=[3459 3489 3526 3657.2 3714 5454 5967 7432 8212 10938];
s=0;
for i=1:10 %n=10;
s=s+x0(i);
x1(i)=s
end
for j=1:9 %n-1=9;
G(j,1)=-(x1(j+1)+x1(j))/2
G(j,2)=1
end
for k=1:9
Y(k,1)=x0(k+1)
end
a1=inv(G'*G)*G'*Y
a=a1(1)
u=a1(2)
for k=0:9
x2(k+1)=(x0(1)-u/a)*exp(-a*k)+u/a
end
x3(1)=x0(1)
for k=1:9
x3(k+1)=(1-exp(a))*(x0(1)-u/a)*exp(-a*k)
end
Error using ==> *
Matrix dimensions must agree.
Error in ==> C:\MATLAB6p1\work\proF.m
On line 14 ==> a1=inv(G'*G).*G'*Y

Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x0=[3459 3489 3526 3657.2 3714 5454 5967 7432 8212 10938];s=0;for i=1:10 %n=10;s=s+x0(i);x1(i)=sendfor j=1:9 %n-1=9;G(j,1)=-(x1(j+1)+x1(j))/2G(j,2)=1endfor k=1:9Y
我这边运行没有问题啊