PlotWithMatlab

PlotWithMatlab - Dr. Dobbs' Howto: Create a scatter plot in...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Dr. Dobbs’ Howto: Create a scatter plot in Matlab This howto document walks you through the creation of an x-y scatter plot, and drawing a line through it in Matlab. 1. Open matlab. Start Æ All Programs Æ Matlab Æ Matlab. 2. Let’s create some a vector of x-data with 8 points from 1 to 8. For the x-data we use the notation [1:1:8] , where 1 to 8 is the range for the data, and 1 is the interval >> x= [1:1:8] x = 1 2 3 4 5 6 7 8 3. and the y-data: >> y = [4.81,7.72,8.41,13.18,12.86,15.11,18.06,19.05] 4. And let’s plot it the simplest way possible >> plot(x,y) hmm, that’s ugly, and isn’t the type of scatter plot we were after. Matlab has joined the points with straight blue lines by default. Let’s look up some options for the plot command in Matlab Æ help Æ index Æ “plot”, and to draw plot dots for each data-point. >> plot(x,y,'.','MarkerSize',20,'MarkerEdgeColor','black')
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This looks much better. 5.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2008 for the course PHYS 257 taught by Professor Dobbs during the Fall '07 term at McGill.

Page1 / 4

PlotWithMatlab - Dr. Dobbs' Howto: Create a scatter plot in...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online