File Exchange

image thumbnail

Neighboring distance of data points

version (1.12 KB) by Joris Meurs
Calculate the distance between neighboring data points


Updated 28 Apr 2016

View License

File name : 'ndistance.m'. This file can be used
for calculating the distance between neighbouring data
points based on Pythagoras theory:
d = sqrt((X(l+1)-X(l)).^2+(Y(l+1)-Y(l)).^2)

or in short:

d = sqrt((dX).^2+(dY).^2))

Four input values: 'X', 'Y'
One output value: 'D'

X = vector of x-values
Y = vector of y-values

D = distance between two neighbouring data points
Additionally, a plot of the distance against the Y-vector
will be generated

Input syntax: d = ndistance(X,Y)

Developed by Joris Meurs BASc (2016)

Cite As

Joris Meurs (2020). Neighboring distance of data points (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)


Description updated

Added picture
Removed error in plot

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux