I have a matrix (A) that is size 30x30 and I want to add it to a matrix of zeros of size 33x33 (B). I need the final matrix B to have A in the lower right corner of matrix B. How would I go about writing that into Matlab?
If you just want to replace the lower right part of B:
B(4:33,4:33) = A;
or if you really do want to addA to that part of B, as it says in your question title:
B(4:33,4:33) = B(4:33,4:33) + A;
0
votes
I guess you really need something like
B(4:33,4:33) = A;
Or:
B(4:33,4:33) = B(4:33,4:33) + A;
But perhaps also interesting:
B(end+1:end+30,end+1:end+30)=A
This can easily be adjusted to make for nice concatenations below or to the right.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more