DDDA

DDDA

You are now following this Submission

X_o = input('X_o: '); % Initial Point on X-coordinate
Y_o = input('Y_o: '); % Initial Point on Y-coordinate
X_1 = input('X_1: '); % Final Point on X-coordinate
Y_1 = input('Y_1: '); % Final Point on Y-coordinate
dx = abs(X_1-X_o); % Difference between points in X-axis
dy = abs(Y_1-Y_o); % Difference between points in Y-axis
n = max(dx,dy); % To select the steps
X(1)=X_o; Y(1)=Y_o; j=1;
for i = 0:1:n
if (X_1 == X)&(Y_1 == Y)
break
end
j =j+1;
X(j)= X(j-1) + (dx/n);
Y(j)= Y(j-1) + (dy/n);
end
plot(round(X),round(Y));
legend('DDA Line');
title('DDA Algorithm')
xlabel('X Axis'); %labeling the X axis
ylabel('Y Axis'); %labeling the Y axis

Cite As

Jash (2026). DDDA (https://in.mathworks.com/matlabcentral/fileexchange/155392-ddda), MATLAB Central File Exchange. Retrieved .

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0