作业帮 > 综合 > 作业

MATLAB 怎么建立这样三对角矩阵?

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/05/10 00:04:14
MATLAB 怎么建立这样三对角矩阵?
a=1:1:9;b=2:1:10;
for j=1:10
V(j,j)=1.0;
if j>1
V(j-1,j)=a;
V(j,j-1)=b;
end
end
建立这样的三对角矩阵,运行后提示说Subscripted assignment dimension mismatch.
要是改为
V(j-1,j)=a0(1,1:9);
V(j,j-1)=b0(1,1:9);
这样也出现Subscripted assignment dimension mismatch.
MATLAB 怎么建立这样三对角矩阵?
diag(1:9, 1) + diag(2:10, -1) + eye(10)