MATLAB: Matrix define using for loop matrix How to define the following matrix (penta diagonal) using for loop? Best Answer Read about diag. A = -4*ones(9,1) ; B = [1 1 0 1 1 0 1 1] ; C = ones(1,6) ; iwant = diag(C,-3)+ diag(B,-1) + diag(A) +diag(B,1) + diag(C,3) Related SolutionsMATLAB: How to get the secondary diagonal of a matrix diag(fliplr(A)) MATLAB: Eigenvalues and orthonormal eigenvectors Yes there is. Look at the eig function. Related QuestionChol() Error with Real, Symmetric, Positive Definite, 3-by-3 MatrixHow do i use the indices from [M,I]=max(A,[],3) to find the corresponding values in another 3D array, B, of the same size as A
Best Answer