March 16, 2014

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

04:30 Posted by Danan Kive No comments
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:

1.Open Matlab on your Computer
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 ! 

 Image Attribution: Matlab Logo: http://electrosome.com/wp-content/uploads/2012/12/Matlab_Logo.png Thanks for letting us use that.
-------------------------------------------------------------------------------------------------
Follow our blog posts @ Follow. So that you won't miss any interesting post and also to be the first to know the answers to many interesting questions.
Follow us on our Facebook  page @ Fre Blogg 
Head over to my You Tube channel for some interesting tutorials @ You Tube
        Check the "Random Post Viewer" to your right and try your luck

0 comments:

Post a Comment

Please Enter your comment here......