[PDF] [PDF] Plotting using Matlab - SEPnet

useful for demonstrating all the different plotting functions available in Matlab Generate a figure by writing “figure; plot(x(1,:))“ in the command line This figure



Previous PDF Next PDF





[PDF] Basics of Plotting in Matlab

To use the 'plot' function in Matlab, you should first make sure that the matrices/ vectors you are trying to use are of equal dimensions For example, if I wanted to  



[PDF] Using MATLAB Graphics (PDF)

MATLAB® plotting functions and tools direct their output to a window that is separate from the Command Window In MATLAB this window is referred to



[PDF] Week 2: Plotting in Matlab

28 jan 2019 · See that Matlab essentially plots a piecewise linear function between the points (0,0), (1,1), (2,4) and (3,9) What Matlab does is match up the x and y vectors to make points Figure 1: A plot of the vectors [0,1,2,3] and [0,1,4,9] Matlab can only plot the points you give it



[PDF] Basic Plotting with MATLAB - csail

For example, let's plot the cosine function from -2 to 1 To do so, we need to provide a discretization (grid) of the values along the x-axis, and evaluate the 



[PDF] Plotting using Matlab - SEPnet

useful for demonstrating all the different plotting functions available in Matlab Generate a figure by writing “figure; plot(x(1,:))“ in the command line This figure



[PDF] Using MATLAB Graphics - UFJF

Using MATLAB functions at the command-line or in an M-file Interactive Plot Editing If you enable plot editing mode in the MATLAB figure window, you can 



[PDF] MATLAB Tutorial

The most basic plotting command in MATLAB is plot The plot function has different forms, depend- ing on the input arguments If y is a vector, plot(y) produces a 



[PDF] Using MATLAB Graphics - LPNHE

MATLAB provides a variety of functions for displaying vector data as line plots, as well as functions for annotating and printing these graphs The following table 



[PDF] MatLab Basics

To graph the piecewise function f (x) = x, x < 0 x2 x ≥ 0 Ï Ì Ó , you must define two intervals x1 and x2 Each function must be defined in terms of its interval For  



[PDF] Getting Started with MATLAB

The plot function has different forms, depending on the input arguments If y is a vector, plot(y) produces a piecewise linear graph of the elements of y versus the 

[PDF] plot matlab color change

[PDF] plot matlab color grey

[PDF] plot matlab color marker

[PDF] plot matlab color rgb

[PDF] plot matlab color vector

[PDF] plot matlab colorbar

[PDF] plot matlab online

[PDF] plot multiple csv files python

[PDF] plot survival curves for coxme

[PDF] plotter paper size a0

[PDF] plotter paper size standards

[PDF] plotting graphs in matlab examples pdf

[PDF] plt returns

[PDF] plt test 7 12

[PDF] plumb bob distortion model opencv

Plotting using Matlab

Vytautas Astromskas

Contents

1 Manipulating a plot using GUI 2

2 Manipulating a plot using command line 4

3 Adding multiple lines to the same plot 5

4 Logarithmic axes 6

5 Plotting matrices 7

6 Plotting 3D surfaces 9

1

1 Manipulating a plot using GUI

It is important to display your graph in a clear and informative manner in order for your data to be represented well. There are a couple of ways to manipulate your graph using Matlab. First one uses Matlab's Graphic User Interface (GUI). This is convenient for polishing a single plot. However, all of the manipulations can be implemented in your script so that a generated gure will have all the required labels, legends, font sizes and such already generated. First, let us generate some data. Let us dene x to be magic(100) matrix. This will be useful for demonstrating all the dierent plotting functions available in Matlab. Generate a gure by writing\gure; plot(x(1,:))\in the command line. This gure

will contain the rst row of the x matrix.In order to manipulate your graph using the GUI,\Edit\and\Axes Properties\

in the drop down menu. A window will appear allowing you to manipulate the labels, title, legend, font sizes, linewiths and everything else you might need to tailor your plot for publication. 2 First,label the axes. You can access that in the \X axis\ and \Y axis\ tabs in the bottom of the screen. As an example, change the x label to be \Time (s)\ and y label to be \Current (mA)\. In the axis' tabs you can also change the range that you want to be displayed as well as the type of the axis, whether it is logarithmic or linear. Now, add thetitleby inputting \Current over Time\ inside the box on the left hand side of the window. You should see a title appearing on the top of your gure. In order to change the font orfont size of your labels, double click on the label. A dierent sub-window will change on the bottom of the \Axes Properties\ window. Change the font size to be \16\. I nd this to be used as a rule of thumb in most cases. Also, change the font to bold. Moreover, perform the same actions on the Y axis and the title. In order to change thefont size of the numbers on your axes, select your graph again and go to \Font\ tab. Here, change the font size to 16 to match the labels. Legendis added by clicking the \Insert Legend\ button in the toolbar and a legend should appear. You can move the position of the legend on the gure as well as change the string explaining the line. In order to change the text, double click on the legend and type 3 ux\ in this case. Finally, you can alter the way the line itself is represented. Click on the line of your graph and you can change the style, color and line width on the right hand side of the of the sub-window. As an example, change the line width to \2\. I usually keep it \2\ as a rule of thumb.2 Manipulating a plot using command line These are the commands to use in the command line to perform the same gure manipula- tions as using the GUI: xlabel('String')assigns text to your x axis. If you want to change the font size, then add a property after the string i.e.xlabel('String','fontsize', Font size value). The same goes for y axis i.e.ylabel('String','fontsize',Font size value') Title is added usingtitle('String','fontsize',value') Changing the font size of the numbers on the axes is a bit dierent. You have to have the gure you want to alter opened. Afterwards enterset(gca,'fontsize', value). This sets 4 the font size of the current gure to the value you want. The legend is added usinglegend('String').3 Adding multiple lines to the same plot Firstly, dene the dierent variables you want to plot. As an example, dene x1 = 1:10; y1 = x1 * 2; y2 = x1 * 5; y3 = x1 * 10; This provides us with three dierent variables to plot.

Now, if you want to put them on the same gure:

gure;plot(x1,y1,x1,y2,x3,y3); You can put as many lines as you want as long as you dene it x axis variable followed by an y axis variable. 5

4 Logarithmic axes

I have showed how to change the type of axes from linear to logarithmic in the rst section. If you want to perform the same action using the command line you have to usesemilogx orsemilogyfunctions which change x and y axes from linear to logarithmic, respectively. As an example, dene y4= x1 * 500; . This way using plot function your y1, y2 and y3 lines would not be visible. However, plotting all four lines using semilogy allows you to represent all the data using the same gure. gure;semilogy(x1,y1,x1,y2,x1,y3,x1,y4); 6

5 Plotting matrices

The most common function for plotting matrices isimagesc. Imagesc creates a two dimen- sional view of your matrix with rows and columns shown in x and y axes, respectively. The value of your matrix is going to be shown on the colorscale.Imageschas an advantage over imageas it automatically adjusts the colorbar axes to accommodate the data. In order to visualise this rungure;imagesc(x)andgure;image(x)to compare the results. I would recommend usingimagesc. 7 In order to adjust the colobar scale on yourimagescgraph you have to use two functions. Firstly, add the colorbar usingcolorbar. Secondly, usecaxis([minvalue maxvalue]). Caxishas to be dened as a vector. As an example, use caxis([5000 10000]) on the gure you have plotted previously.8

6 Plotting 3D surfaces

Surfis used to plot 3D surfaces. The syntax for surf issurf(x,y,z,C)in order to dene the dimensions of each of the three dimensions as well as the colorscaling using the C vector. In our example, you can plotsurf(x)just as happily. In this case it will assign the matrices rows and columns to be x and y axes. Z axis is going to be dened as the minimum and maximum of your values in the matrix. Colorscale is going to be the same as the Z axis. In order to change the viewing angle you can useview(AZ,EL)function where AZ is the azimuthal or the horizontal angle and EL is the vertical elevation.

For our example, usegure;surf(x);view(10,80)9

quotesdbs_dbs19.pdfusesText_25