MATLAB: I have 3*3*20 matrix and 1*1*20 matrix. how to multiply. I have multiply q and za arraycell arraysMATLABMATLAB C/C++ Math Librarymatrix manipulation q(:,:,1:20); %3*3 Matrix za(1:20); % 1*1 Matrix How to multiply q and za. Error using q*za or q.*za Best Answer Hi Ranjan,if you want to multiply each 3x3 Matrix q(:,:,idx) with the corresponding za(1,1,idx), then this should work:q = rand(3,3,20);za = rand(1,1,20);result = bsxfun(@times, q, za);Titus Related SolutionsMATLAB: How to write Continue Long Statements on Multiple Lines Use repmat to avoid manually typing all 160 of those ‘%q’ repeats! Try this: formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]']; MATLAB: Multiply along sum(cumprod(A)) Related QuestionLagrange MultipliersReshape 3d to 2d arrayMultiplying a matrixError of matrix dimensions must agreeMerging/Multiplying Functions
Best Answer