# How to Connect Points in MATLAB

Written by sean hill
• Share
• Tweet
• Share
• Pin
• Email

Matlab is a programming language that allows users to enter, manipulate, plot and analyse data in a variety of ways. Matlab's built-in graphing utility, the "plot" function, can yield a graph of a set of points and also can draw lines between these points. Once you have plotted a set of points, invoke the plot function again with the specific data points you want to connect.

Skill level:
Moderately Easy

### Things you need

• Matlab R2006 or later version

## Instructions

1. 1

Open Matlab. Plot the data that contain the points you want to connect. Use the "Plot" function.

2. 2

Identify the x-coordinates of the two points you want to connect. Type "x = [x1, x2]" in the command window. For example, if you want to connect (1,5) and (3,6), type "x = [1,3]."

3. 3

Identify the y-coordinates of the two points you want to connect, and type "y = [y1,y2]" in the command window. For example, if you want to connect (1,5) and (3,6), type "y = [5,6]."

4. 4

Type "plot(x,y)" in the command window to connect the two points.

#### Tips and warnings

• To plot the whole set of data, type "plot(X,Y)" in the command window. "X" should be a set of x-coordinates. "Y" should be a set of y-coordinates.
• If you want to connect more points, repeat steps 3, 4, and 5 with new points.

### Don't Miss

#### References

• All types
• Articles
• Slideshows
• Videos
##### Sort:
• Most relevant
• Most popular
• Most recent