# FreBlogg

## How to plot a graph with discrete data points in Matlab?

04:30 Posted by Unknown
Matlab is a very popular Software package for almost all disciplines of science and Technology. Matlab is

used regularly by many people for many complex and ground breaking applications. But, people don't use it for one simple thing, Plotting graphs when we have a set of discrete data points. Probably the major reason for this is that many people don't know how to plot this kind of graph. So, in this article we will try to show you how you can do this in Matlab.
Let's consider that the set of coordinates are as follows :

### Steps:

2.Open Matlab Editor Window or click Ctrl+N
3.Seeing your data points, write a Matlab program just like the one shown below.
```clc
clear all
close all
x = [1 2 3 4 5 6 7 8];     %All the x coordinates
y = [-2 -4 -4 5 8 1 9 10]; %All the y coordinates
plot(x,y)
grid on                    %Switches 'on' the grid display
```
4.The graph output will look something like this, just as we can expect.
So, That's it. Simple enough. Try this new way & you'll probably open Matlab much often than you normally would. Thanks for Visiting and As always, Have a Happy Reading !