
dz = z(2)-z(1);
dx = gradient(x,dz);                                
dy = gradient(y,dz);
ds = hypot(dx, dy);                                 
cum_arclen = cumtrapz(z, ds);                       
tot_arclen = cum_arclen(end);                       


figure(1)
plot(x,y,   x,cum_arclen)
grid
axis equal
legend('Original Data', 'Arc Length', 'Location','NW')


filename = '/Users/dani/Desktop/bogenlaenge.mat';
save(filename)

save /Users/dani/Desktop/bogenlaenge.mat;
