How to plot points in matlab

Written by michael peter
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to plot points in matlab
A plot helps visualise large sets of data to identify trends and patterns. (Jupiterimages/Comstock/Getty Images)

The technical computing software MATLAB stores, processes and analyses data contained in arrays and matrices. After manipulating the data to its final form, plotting the data makes it easier to visualise 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.

Skill level:
Moderately Easy

Other People Are Reading

Instructions

  1. 1

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

  2. 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].

  3. 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).

  4. 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 labelled "marker."

Tips and warnings

  • Omitting the "." from the code in step 3 will connect all points by a continuous line.
  • You can also change the thickness and colour of the marker in the "Show Plot Tools and Dock Figure" menu.

Don't Miss

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

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.