MATLAB: I want to add a 20 by 20 matrix to a 50 by 50 matrix ? the resuting matrix should be of 50 by 50 . addition of square matrices For Example : A=5*ones(50) & B=2*ones(20) , how should A+B be evaluated ? Best Answer A=5*ones(50)B=zeros(50);B(1:20,1:20)=2*ones(20);C=A+B; Related SolutionsMATLAB: I have a marix of zeros(100*100) and i have 5 values of rows and cols in rc.(getting these values from another function). Now i want to make a new matrix B of same size as A(100*100) and want ones on that rows and cols provided by rc and zeros else rc = [2 5 3 5 7 9 15 69 95 6];B = full(sparse(rc(:, 1), rc(:, 2), 1, size(A, 1), size(A, 2)));is one way of doing it. Another way:B = zeros(size(A));B(sub2ind(size(B), rc(:, 1), rc(:, 2))) = 1; MATLAB: What do you mean by mask(50:end-50,50:end-50); How about this:It writes a white rectangle into the middle of an array. Presumably it's black/false/0 in the 50 pixel wide border around the mask image. It can be used to blacken the gray scale image either inside or outside the mask area. Related QuestionHow to sort matrix according to another matrix in matlabCode that generate 50 by 50 matrix of 0’s and 1’s of which 20% is 1’s.We want to create a random 20×20 circulant matrix. Please help!I need to create letter K with 20 pixel by 20 pixel by plottingWhy step size is divided by 50
Best Answer