clear all % Drag and Drop method
global mip scw sch x y xx hFig hAxes;
scrsz = get(0,'ScreenSize'); % screen, figure and axe constants
wscr = 640;
hscr = 440;
waxe = wscr-40;
haxe = hscr-40;
wgr = 6;
hgr = 4;
scw = waxe/wgr;
sch = haxe/hgr;
pl = (scrsz(3)-wscr)/2; % left bound
pu = (scrsz(4)-hscr)/2; % upper bound
mip = 0; % mouse is not pressed
%======= Interface ========================
hFig = figure('Position',[pl pu wscr hscr],...
  'Resize','off','MenuBar','none',...
  'NumberTitle','off','Name','Spline Interpolation',...
  'WindowButtonMotionFcn','ChangePointer;',...
  'WindowButtonDownFcn','mip=1;','WindowButtonUpFcn','mip=0;',...
  'renderer','opengl');
hAxes = axes('Units','pixels','Position',[20 20 waxe haxe],...
  'XLim',[0 wgr],'YLim',[0 hgr]);
%======== Create and plot spline ================
x = 0:wgr; % abscissas
y = rand(1,wgr+1)*hgr; % ordinates
xx = 0:0.01:wgr;
PlotSpline; % plot spline to hAxes
