Can we change the value of a specific element of an array in Mathematica?
Basically, I have the following given MATLAB script which writes a big 3N-by-3N matrix $h$ by combining two 3-by-3 matrices $Hch$ and $tau$. The connection between big $h$ and $Hch$ and $tau$ is as follows (for N=5):
$$h= \begin{bmatrix} Hch &tau &0 &0 &0 \\ tau'&Hch &tau &0 &0\\ 0 &tau'&Hch &tau &0\\ 0 &0&tau'&Hch &tau\\ 0 &0 &0 &tau'&Hch\\ \end{bmatrix} $$ I don't know how to convert my Matlab code's expressions like h( (3*x)+1:...) = Hch into Mathematica. Please help. Is there any other way to get what my Matlab code doing in Mathematica?
Hch = -[-4*Delta f(k1)*T T';
f(-k1)*T' -4*Delta T;
T T' -4*Delta];
tau = -[0 0 T';
0 0 T*exp(-1i*k1);
0 0 0];
h = zeros(3*N,3*N);
for x = 0:N-1
h((3*x)+1:(3*(x+1)),(3*x)+1:(3*(x+1))) = Hch; %diagonal elements-> (3*x)+1 : 3*(x+1) = Hch
if x~=N-1 %assigning off-diagonal elements.
h((3*x)+1:(3*(x+1)), (3*(x+1))+1:(3*(x+2))) = tau;
h((3*(x+1))+1:(3*(x+2)), (3*x)+1:(3*(x+1))) = tau';
end
end
h(1,1)= h(1,1)-Delta;
h(end,end)=h(end,end)-Delta;