MATLAB: Multiplying a matrix multiplication i have a matrix A=[3 5 7 5 6 0 5 9 4] i want to square each element and add along row wise and display for ex 3^2+5^2+7^2 ans is 89 so i need as 89 71 122 pleas guide Best Answer A=[3 5 7; 5 6 0; 5 9 4];for x = 1 : 3 B(x,:) = sum(A(x,:).^2);endB Related SolutionsMATLAB: Trying to code a tricky double summation Something like this should works = 0;for i=0:min(x,y) for k=0:x-1 s = s + (-1)^k * D(2*x-2*k-2*i, 2*y+2-2*i) * T(2*x-2*k-2*i, 2*y+2-2*i)^(z/2) endend MATLAB: 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]']; Related QuestionDear friends, the long matlab command that I have written is error. I want to be spelled the same way but without error.How to replace numbers in an arrayI am getting error matrix demension does not agreeIndex exceeds matrix dimensionAddition of elements in a matrix
Best Answer