MATLAB: I have to create a matrix using only zeros, ones and eye oneszeros eye This is the matrix: 1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 so far I wrote B=ones(1,5); C=eye(4,5); A=[B;C] But this command didn't come out right. Can someone please help me. Best Answer your command A = [B;C] concatenated them vertically.Try:C = eye(5)C(1,:) = 1; % turns every element along the first row to 1. Related SolutionsMATLAB: Creating a Matrix including ones on diagonal kron(eye(4),ones(1,5)) MATLAB: How can you create a metric using ones, zeros, eye Just manual you can do that, as I don't find the relationships between elements. apart from just in the second row, 1 position shifting in 1st rowA=zeros(4,6); A(1,:)=[3 0 0 4 4 0]; A(2,:)=[0 3 0 4 4 0]; A(3,:)=[1 1 3 4 4 0]; A(4,:)=[1 1 2 2 2 2];A = 3 0 0 4 4 0 0 3 0 4 4 0 1 1 3 4 4 0 1 1 2 2 2 2 Related QuestionAutomatically filling a matrixCreating a large matrix with a patternEye mouseRemove elements from a matrix
Best Answer