I want to create the following matrix in MATLAB:
M= [ 0 0 1 10 20
0 0 3 8 26
0 0 5 6 32
0 0 0 0 0]
but I don't want to input all elements manually.
I tried M (1:3,3:5)=[x;y;z]
where
x
is the linspace of 1 to 5y
is the linspace of 10 to 6z
is the linspace of 20 to 32
but it doesn't work (the last row of zeros is missing). How can I create M
in a smart way?