Index exceeds matrix dimensions.什么错误啊?a=zeros(8);l=zeros(8);u=zeros(8);for (i=2:8)a(i,i)=5;a(i,i-1)=-2;a(i-1,i)=-2;l(i,i)=1;enda(1,1)=2;l(1,1)=1;u(1,1)=a(1,1);for (i=2:8)l(i,i-1)=a(i,i-1)/u(i-1,i-1);u(i,i)=b(i,i)-c(i-1,i)*l(i,i-1);endalud=[
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 06:33:46
Index exceeds matrix dimensions.什么错误啊?a=zeros(8);l=zeros(8);u=zeros(8);for (i=2:8)a(i,i)=5;a(i,i-1)=-2;a(i-1,i)=-2;l(i,i)=1;enda(1,1)=2;l(1,1)=1;u(1,1)=a(1,1);for (i=2:8)l(i,i-1)=a(i,i-1)/u(i-1,i-1);u(i,i)=b(i,i)-c(i-1,i)*l(i,i-1);endalud=[
Index exceeds matrix dimensions.什么错误啊?
a=zeros(8);
l=zeros(8);
u=zeros(8);
for (i=2:8)
a(i,i)=5;
a(i,i-1)=-2;
a(i-1,i)=-2;
l(i,i)=1;
end
a(1,1)=2;
l(1,1)=1;
u(1,1)=a(1,1);
for (i=2:8)
l(i,i-1)=a(i,i-1)/u(i-1,i-1);
u(i,i)=b(i,i)-c(i-1,i)*l(i,i-1);
end
a
l
u
d=[220/27 0 0 0 0 0 0 0];
d=d';
y=(l^(-1))*d;
x=(u^(-1))*y;
x
Index exceeds matrix dimensions.什么错误啊?a=zeros(8);l=zeros(8);u=zeros(8);for (i=2:8)a(i,i)=5;a(i,i-1)=-2;a(i-1,i)=-2;l(i,i)=1;enda(1,1)=2;l(1,1)=1;u(1,1)=a(1,1);for (i=2:8)l(i,i-1)=a(i,i-1)/u(i-1,i-1);u(i,i)=b(i,i)-c(i-1,i)*l(i,i-1);endalud=[
下标越界.除零了吧