Hi I have a problem with the connected point. Use the mouse will add points to the picture and I link will successively, but the first and last point discontinuity will help someone? Thanks a lot in advance.
function [xs, ys, n, t] = bodbut = 1;hold onx = [ ];y = [ ];%seznam vybranych bodu
n = 0;% zobrazeni navodu pro vyber bodu
disp('Levym tlacitkem misi vkladate bod.')disp('Pravym tlacitkem misi vložite posledni bod.')but = 1; while but == 1 [xi,yi,but] = ginput(1); %vlozi novy bod
plot(xi,yi,'r.'); n = n+1; x(:,n) = xi; y(:,n) = yi; end%inetrpolace podle krivky a jemnejsi radkovani
t = 1:n;ts = 1:0.1:n;ys = spline(t,y,ts);xs = spline(t,x,ts);% Graf interpolované krivky
plot(xs,ys,'r-');
Best Answer