How to Plot Points in MATLAB

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
A plot helps visualize large sets of data to identify trends and patterns.

The technical computing software MATLAB stores, processes and analyzes data contained in arrays and matrices. After manipulating the data to its final form, plotting the data makes it easier to visualize the data to identify trends and other patterns. Plotting multiple data sets together helps correlate the trends between the two. There are many ways of representing the data on a plot, including using individual markers to represent unique data points or connecting each data point with a line. Learn how to represent the data using individual markers in a MATLAB plot.

Advertisement

Step 1

Clear all active variables within the workspace by entering "Clear All" into the Command window.

Video of the Day

Step 2

Create two arrays of data as sample points to plot, with one array representing the x-data, the other the y-data. For example, input "x=1:1:10." This creates the array [1 2 3 4 5 6 7 8 9 10]. Input "y=2:2:20" to create y-data. This will generate the array [2 4 5 6 8 10 12 14 16 18 20].

Advertisement

Step 3

Enter into the command window "plot(x, y, ".") to plot the points. The "." in the code places a "." at each coordinate of the x-y matrix. For instance, a point will be placed at (1,2) and (2,4).

Advertisement

Step 4

Click on the "Show Plot Tools and Dock Figure" in the figure menu to change the marker type. Click on one individual marker and select an appropriate icon under the pull-down menu labeled "marker."

Video of the Day

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...