function [K Ke]=buildDifferentialJacobiMatrix(M, Me) % reference K_ref, Ke_ref is the first row of M K_ref=M(1,:); Ke_ref=Me(1,:); % assume the "rest" rows and store them to K, Ke [m n]=size(M); K=M(2:m,:); Ke=Me(2:m,:); % build differences for i=1:m-1 K(i,:)=K(i,:)-K_ref; % difference % calculate error by progression ve=Ke(i,:); for j=1:n Ke(i,j)=sqrt(pow(ve(j),2)+pow(Ke_ref(j),2)); endfor endfor endfunction