defind the point from two var of x and two var of y in matlab

Assuming you have two variables, x1 and x2 containing the two x-coordinates and two variables, y1 and y2 containing the two y-coordinates of the two points, you can define those points as follows:

main.m
% Define two points
point1 = [x1, y1];
point2 = [x2, y2];
58 chars
4 lines

You can then plot these points on a graph as follows:

main.m
% Plot the points
plot(point1(1), point1(2), 'ro'); % Plot point1 as a red circle
hold on; % Retain the current plot
plot(point2(1), point2(2), 'bs'); % Plot point2 as a blue square
182 chars
5 lines

This will plot the two points on a graph with point1 represented by a red circle and point2 represented by a blue square.

related categories

gistlibby LogSnag