How can I replace the upper off diagonal(super diagonal) and lower off diagonal(sub diagonal) of a matrix?
Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector?Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector? Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector? symmetric, tridiagonal, off diagonal MATLAB Answers — New Questions