Skip to content

Instantly share code, notes, and snippets.

@argaghulamahmad
Last active May 13, 2019 13:47
Show Gist options
  • Save argaghulamahmad/46df191b8e36c86cadd2137f09241bef to your computer and use it in GitHub Desktop.
Save argaghulamahmad/46df191b8e36c86cadd2137f09241bef to your computer and use it in GitHub Desktop.
function pathcalculator(n)
plot([-1 1],[0,0],'k',[0 0],[-1 1],'k');hold on
t=0:.02:1;
xdata = zeros(1,n);
ydata = zeros(1,n);
for i=1:n
[x,y] = ginput(1) % get three mouse clicks
plot(x, y, 'bo');
xdata(i) = x;
ydata(i) = y;
endfor
xf = [-1:0.05:1];
xp = [-1:1];
spl = interp1 (xdata, ydata, xf, "spline");
plot (xf,spl,"m");
legend ("spline");
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment