conec=[1 2 3;3 2 4;4 2 5]; coord=[4 8 4 8 12; 2 2 6 8 4 ]; nel=size(conec,1);npe=size(conec,2); nod=size(coord,2); xhat=[1/8:1/8:6/8 1/8:1/8:5/8 1/8:1/8:4/8 1/8:1/8:3/8 1/8 2/8 1/8; 1/8*ones(1,6) 2/8*ones(1,5) 3/8*ones(1,4) 4/8*ones(1,3) 5/8 5/8 6/8]; nhat=size(xhat,2); [g dg d2g] = masterp1(2,xhat); figure 1; for k=1:nel XX(:,1)=coord(:,conec(k,1)); XX(:,2)=coord(:,conec(k,2)); XX(:,3)=coord(:,conec(k,3)); x=zeros(2,nhat); for i=1:npe x(1,:)=x(1,:)+XX(1,i)*g(i,:); x(2,:)=x(2,:)+XX(2,i)*g(i,:); end d=k; scatter(x(1,:),x(2,:),20,d,"filled") hold on; d=8; scatter(XX(1,:),XX(2,:),20,d,"filled") end hold off