from Fitting NURBS to a given set of data points by Vikash Gupta
Given a set of six points a closed NURBS curve is used to approximately fit all the six data points.

inputfile.m
 A= [6.787351548577734   7.060460880196088
   7.577401305783335   0.318328463774207
   7.431324681249162   2.769229849608900
   3.922270195341682   0.461713906311539
   6.554778901775567   0.971317812358475
   1.711866878115618   8.234578283272926];



%  A=10*rand(6,2);
hold on;
% axis([0,20,0,20]);
% A=ginput(6);
% pause

% P1=[A(1,:);A(2,:);A(3,:);A(4,:);A(1,:)];
% P2=[A(2,:);A(3,:);A(4,:);A(5,:);A(2,:)];
% P3=[A(3,:);A(4,:);A(5,:);A(6,:);A(3,:)];
% P4=[A(1,:);A(2,:);A(5,:);A(6,:);A(1,:)];
% P5=[A(2,:);A(3,:);A(5,:);A(6,:);A(2,:)];
% P6=[A(1,:);A(2,:);A(4,:);A(5,:);A(1,:)];
% P7=[A(1,:);A(4,:);A(5,:);A(6,:);A(1,:)];
% P8=[A(1,:);A(2,:);A(3,:);A(6,:);A(1,:)];
% P9=[A(1,:);A(2,:);A(3,:);A(5,:);A(1,:)];
P1(1,:)=[6,1];          
P1(2,:)=[10,0];
P1(3,:)=[10,10];
P1(4,:)=[0,10];
P1(5,:)=[6,1];

P2(1,:)=[10,4];          
P2(2,:)=[12,3];
P2(3,:)=[15,5];
P2(4,:)=[12,10];
P2(5,:)=[10,4];

P3(1,:)=[6.8,10];          
P3(2,:)=[13,14];
P3(3,:)=[10,12];
P3(4,:)=[0,1];
P3(5,:)=[6.8,10];

P4(1,:)=[5,6];          
P4(2,:)=[16,8];
P4(3,:)=[14,10];
P4(4,:)=[20,10];
P4(5,:)=[5,6];

P5(1,:)=[6,4];            
P5(2,:)=[10,13];
P5(3,:)=[19,8];
P5(4,:)=[7,2];
P5(5,:)=[6,4];

P6(1,:)=[16,14];            
P6(2,:)=[20,3];
P6(3,:)=[11,8];
P6(4,:)=[7,2.5];
P6(5,:)=[16,14];

P7(1,:)=[6.8,2];            
P7(2,:)=[1,14];
P7(3,:)=[3,8];
P7(4,:)=[4,5];
P7(5,:)=[6.8,2];

P8(1,:)=[5,2];            
P8(2,:)=[13,17];
P8(3,:)=[9,2];
P8(4,:)=[7.6,4.8];
P8(5,:)=[5,2];

P9(1,:)=[12,4];            
P9(2,:)=[14,6];
P9(3,:)=[9,8];
P9(4,:)=[7.9,2.8];
P9(5,:)=[12,4];

Contact us at files@mathworks.com