MATLAB: Build m x m matrix

urgent question

Hello, I wanna build a matrix of m nods. I have some questions:
1-
if F=[-3 2 -3]
for I=1:m;end
B=eye(I)*F; ---------(1)
the problem here is F in eq (1) is not allowed in matlab, what I have to do to built that matrix which affected by different values of m?
2-
A=[5 -3];C=[-3 4];
I wanna use use the three matrices (A,B,C), to get the result to be like
D= [ 5 -3 0 0 0;
-3 2 -3 0 0;
0 -3 2 -3 0;
0 0 -3 2 -3;
0 0 0 -3 4 ]
What do u suggest??
thanks

Best Answer

Basheer - as F is a 1x3 matrix, the only multiplication with eye(I) that will succeed is when I==1 (since that will be a 1x1 matrix multiplied against the 1x3 matrix F).
What are you attempting to achieve by creating this B? Is it the output of D that you want, and so when you supply a different m, you will get different D matrices?
A = [5 -3];
B = [-3 2 -3];
C = [-3 4];
m = 3;
D = zeros(m+2,size(A,2)+m);
D(1,1:size(A,2)) = A;
D(end,m+1:end) = C;
for k=1:m
D(1+k,k:k+size(B,2)-1)=B;
end
So D becomes
D =
5 -3 0 0 0
-3 2 -3 0 0
0 -3 2 -3 0
0 0 -3 2 -3
0 0 0 -3 4