MATLAB: Column addding column adding i mean i have: y= 1 2 5 3 5 7 2 6 4 x= 1 -2 7 x= 3 5 4 x= 2 -6 2 now i need output as: z=(1-1)^2+(2+2)^2+(5-7)^2 =20 and so on and so on for z(1),z(2). please help!! Best Answer y = [1 2 5 3 5 7 2 6 4];x = [1 -2 7 3 5 4 2 -6 2];z = sum(reshape((x-y).^2,3,[])); Related SolutionsMATLAB: How to fit a series of datapoints using 3 piecewise linear fit lines Use this FEXload data.mat % attached aboveydata(end) = []; % your xdata/ydata do not match in length ! slope0 = struct('p', 1, 'x', [min(xdata) max(xdata)], 'v', [0 0]);% Download BSFK function here% https://www.mathworks.com/matlabcentral/fileexchange/25872-free-knot-spline-approximationpp = BSFK(xdata,ydata, 2, 3, [], struct('KnotRemoval', 'none', 'pntcon', slope0)); % Checkfigurexi = linspace(min(xdata),max(xdata));yi = ppval(pp,xi)plot(xdata,ydata,'b',xi,yi,'r');for xb=pp.breaks xline(xb);endgrid on MATLAB: How can i solve xyz = [-4 3 0; 8 12 7; 6 -6 -5]\[4; 0; -10]; Related QuestionFind missing element between two matrixHow to modify a matrix to change the entries >=0 and multiply it by 5 AND to change the entries <0 and add 2 to those entriesDeleting zeros from cell matrix without resizing or reshaping matrixHow to calculate a numerical approximate derivative vector of a function
Best Answer