function g(x);
clc;
format long;
n=length(x);
z=0;
for i=1:n
z=z+x(:,i);
b(:,i)=z;
end
for i=2:n
y(:,i-1)=x(:,i);
end
for i=1:n-1
c(:,i)=-0.5*(b(:,i)+b(:,i+1));
end
for i=1:n-1
B(i,1)=c(:,i);
B(i,2)=1;
end
k=inv(B.'*B)*B.'*y;
在matlab中调用这个函数,老是报错:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> g at 20
k=inv(B.'*B)*B.'*y;
请问高手是什么意思???