MATLAB: Want to plot data where X and Y axis represent a value from one certain point to another certain point with a constant distance say d between points.

plotting

How plot function is used

Best Answer

clc ; clear all;
point = rand(1,2) ; % a point
dx = 0.5 ; dy = 0.5 ; % distance
N = 100 ; % number of points
points = zeros(N,2) ;
points(1,:) = point ;
for i = 2:N
points(i,:) = points(i-1,:)+[dx dy] ;
end
plot(points(:,1),points(:,2),'.-r')