MATLAB: How to find the product of each element of a matrix by itself and by the other elemets at the same row element-by-element operation on matrices input: x = [a,b,c; d,e,f] output: y = [a^2,a*b,a*c,b^2,b*c,c^2; d^2,d*e,d*f,e^2,e*f,f^2] Best Answer EDIT[n1,n2] = ndgrid(1:size(x));y = x(:,nonzeros(tril(n1))).*x(:,nonzeros(tril(n2))); Related SolutionsMATLAB: How to arrange an array elemets to unique pairs X={'a1', 'b2', 'c3', 'd4'};ii=1:numel(X)jj=nchoosek(ii,2)A=X(jj(:,1))'B=X(jj(:,2))' MATLAB: Sort and extract elemets from a structure. tables are a vastly superior way of handling this data. Does this do it?mydata= readtable('mytext.txt');sorted_data = sortrows(mydata,{'Modul1';'ParamN';'ParamM'}); Related QuestionIf all elemets of a array equal, which array will be choose by MAX functionHow to find non integer elemets in matrixHow to keep the elemets order untouched in heatmpHow to replace multiple elemets at particular index in vector‘reshape’ by identifiersMultiply Matrix by scalar variablesPlot by equation.
Best Answer