I think diag function will help.
https://www.mathworks.com/help/matlab/ref/diag.html
Please try the following script.
N = 5;
h = 5.2;
u = 1.7;
P = diag(repmat(0.1,1,5)) + diag(repmat(u,1,4),-1) + diag(repmat(h,1,4),1);
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!