matlab新手问题h=0.1;t=0:h:1;N=length(t);y=ones(1,N);for k=2:N;y(1,k)=y(1,k-1)+h*(y(1,k-1)-2.*t/y(1,k-1))end问题是Subscripted assignment dimension mismatch.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 10:32:11

matlab新手问题h=0.1;t=0:h:1;N=length(t);y=ones(1,N);for k=2:N;y(1,k)=y(1,k-1)+h*(y(1,k-1)-2.*t/y(1,k-1))end问题是Subscripted assignment dimension mismatch.
matlab新手问题
h=0.1;
t=0:h:1;
N=length(t);
y=ones(1,N);
for k=2:N;
y(1,k)=y(1,k-1)+h*(y(1,k-1)-2.*t/y(1,k-1))
end
问题是Subscripted assignment dimension mismatch.

matlab新手问题h=0.1;t=0:h:1;N=length(t);y=ones(1,N);for k=2:N;y(1,k)=y(1,k-1)+h*(y(1,k-1)-2.*t/y(1,k-1))end问题是Subscripted assignment dimension mismatch.
y(1,k)=y(1,k-1)+h*(y(1,k-1)-2.*t/y(1,k-1))
这句话的问题
数组维度不匹配.
等号左边是一个标量,右边计算得到的是一个1*11的向量.