Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb

Size: px
Start display at page:

Download "Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb"

Transcription

1 Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb Making Plots with Matlab (last updated 5/29/05 by GGB) Objectives: These tutorials are designed to show the introductory elements for any of the topics discussed. In almost all cases there are other ways to accomplish the same objective, or higher level features that can be added to the commands below. Any text below appearing after the double prompt (>>) can be entered in the Command Window directly or in an m-file. For more details about plots read chapter 5 of the book. The following topics are covered in this tutorial; Introduction Using the plot Command Adding Labels, Text, or a Legend Saving Figures Printing Plots Customizing Axes Multiple data in a plot Linestyles, Markers, and Colors Plotting a Function Using fplot Using the pause Command Introduction The purpose of this handout is to cover the basics of creating, editing, and printing graphs. We will only cover 2_dimensional plots in this tutorial. There are considerably more commands that can be used to create more complicated 2-D and 3-D plots. They are covered in the Matlab manual. It is important that you review the rules for making quality plots that are given in H4. Plots in Matlab are created using vectors for the use of vectors and vectors operations you must review Tutorial III. The following commands will be covered in this tutorial: plot: creates a 2-D line plot axis: changes the aspect ratio of x and y axes xlabel: annotates the x-axis ylabel: annotates the y-axis title: puts a title in the plot prints: prints a hardcopy of the plot ===================================================================== Using the plot Command The plot command is used to create two dimensional plots. The simplest form of the command is 1

2 plot (x,y) Vector of independent Vector of dependent variable variable In order to show the plot command we need to create some arrays. Create the following m_file. MATLAB creates the plot by automatically scales the axes, marks the points and connects them with a straight line. It uses its default settings of line types, color, etc. This is what will be shown in the screen when you run the program We need to learn how to add labels and titles to the figure 2

3 Adding labels, title, and legend: There are many features in Matlab. Only the basics will be discussed here. For more details about options see Chapter 5 of the book. The commands xlabel and ylabel can be used to annotate the axis, the command title can be used to create a title of the plot, the command legend can be used to create a legend and the command text can be used to create a text anywhere in the plot. Examples of the syntaxes of these commands are given next: Check on different options This is the label for the axis This is the size for the font This is the color of the font xlabel( \fontname{select type, arial} title for the axis, Fontsize,e.g. 14, Color,e.g. r ) ylabel( \fontname{select type, arial} title for the axis, Fontsize,e.g. 14, Color,e.g. r ) title( \fontname{select type, e.g., arial} title for the graph, Fontsize,e.g. 14, Color,e.g. r ) Commands used for color are given next: Red: r Green: g Blue: b Black: k (this is the default). If you don t specify color Matlab will use black Magenta: m Yellow: y To add a plot legend to your graph, use the syntax; legend( string1, string2,,pos) Text for legend, the order of the text corresponds to the order the lines were created Pos is an optional number that specifies where in the figure the legend is placed. The options are given next. Pos = -1 places the legend outside the axes boundaries on the right side. Pos= 0 places the legend inside the axes boundaries in a location that interferes the least with the graphs Pos =1 places the legend at the upper-right corner of the plot (default) For more options see help legend in Matlab All the options must be written in the m.file after the plot command is used. Otherwise, they would not take effect in the program See the example given below for the use of the options described above. 3

4 This is how the plot will look like: 4

5 You can also manipulate the format of the figure once it is created by using the options given in the menu. You can also export your figure into a word document, power point, or WordPad. See instructions in the printing section of this tutorial. Play with some of the commands of the menu to learn what you can do: For example this is how you can insert a text: You can use this menu to modify some of the format of your plot Click on this box and write text where ever you whish This is how you can change the figure number: Select figure properties 5

6 Click on the title tag Type the text that you want Click OK tag This is what will be shown in your screen after the changes: This is really useful when your program generates different figures 6

7 Saving Figures You cannot save figures. You must save an m_file with all the commands used to create the figure. Get in the habit of using m_files to create figures because editing is much easier. ===================================================================== Printing Plots There are two ways to print plots.! The simplest way is print directly from the figure box.! The alternative is to copy the figure into WordPad. To do this; (a) In the figure box click on EDIT/COPY OPTIONS (b) Click on the Windows Metafile format (it is probably already on) This option 7

8 (c) Turn off the Match Figure Screen Size box (d) Turn on the White Background box (e) Click ON Click OK 8

9 (f) Click on EDIT/COPY FIGURE This option (g) Switch to a word processor document and paste where you want it. If you use a different word processing package you will have to try it with your package. There is a variation in there ability to import and adapt the colors. Customizing Axes There are a great number of axes commands given in detail in manual. The most common use will be; Changing the Default Axes Ranges axis([xmin xmax ymin ymax]) This lets you determine the range of the axes. Customizing the tick marks and ticklabels To set the tick marks to locations other than those selected by Matlab use the following command set(gca,'xtick',[a vector of points where you want the tick marks]) To set the tick labels to other than selected by Matlab use the following. These labels are considered to be text and are handled as such. This most commonly would be done to control the number of decimal points displayed. Each tick label entry in the list must have the same number of characters. If you would like some of the tick marks to be unlabeled, enter the label as the appropriate number of empty spaces. 9

10 set(gca,'xticklabel',['label1'; 'label2'; etc]) label1 and label2 would be something like 1.00, 2.00 etc. Using Log_Log and Semilog Axes We can also create log or semilog plots. In place of the word plot, use;! loglog(x,y)! semilogx(x,y)! semilogy(x,y) Add the following line to your program and see the changes in the figure This is what will be shown on the screen. Notice the new scale 10

11 Multiple Curves in a Plot Multiple plots can be put on the same graph. Vector of independent variable plot (x,y,x,z) Vector of dependent variable You can add as many vectors as needed Vector of dependent variable Vector of independent variable Example: Add the following array to the m_file and replace the plot command. z = [ ]; plot(x,y,x,z) This is the new data The legend was also changed 11

12 This is what will be shown on the screen: Now we need to learn how to change markers Linestyles, Markers, and Colors The Matlab Manual gives the available color, symbol types and linestyle options. If you don't specify Matlab starts with yellow and cycles through the list. The default linestyle is the solid line. The point symbols do not connect the data points with any line type. The general rule is if you have discrete data, use individual symbols (see Handout 3: Quality plots and tables). Using symbols with a linetype connecting them is acceptable if needed to help the reader follow the data. The syntax for changing the default color or linestyle settings is plot (x,y, line specifiers ) Vector of independent Vector of dependent variable variable See some of the options below. Look at the Matlab help for many more Some line specifiers are given below Solid (default): - Dashed: -- Dotted: : Dash-dot: -. 12

13 All the above options can be combined with the color code given on p. 3 of this tutorial. Some marker types are given below: Plus sign: + Circle: o Asterisk: * Point:. Square: s Diamond: d Five-pointed star: p Six-pointed star: h Some examples are given below: plot(x,y, r ) A red line will connect the points plot(x,y, --y ) A yellow dashed line connects the points plot(x,y, * ) The points are marked with * (no line between the points) plot(x,y, g:d ) A green dotted line connects the points that are marked with diamond markers Modify your m.file to print the data with different markers: See the changes to have different markers and colors. Look at H3 for rules 13

14 This is what will be shown in the screen The markers make it easier to distinguish when you print in black and white. Always use different markers do not rely on colors to distinguish. See H3 The experimental data is not joined Data from equations is joined Plotting a Function Using the fplot Command We can also plot a function of one variable between specified limits without creating a data set. When you have a function you should use fplot so that it appears as a smooth curve, not as discrete points. The syntax is fplot('function',[xmin xmax]). Where function is the function to be plotted and xmin and xmax are the independent variable limits. This option is explained with details in section 5.2 of the book. 2 Example: Create a function file that will perform the following operation. z sin ( x) is the independent variable and z is the dependent variable. =, where x 14

15 Create the following main file that will pass the input information to the function and will plot the results of the function. Remember that to make a plot you need several data points, therefore, your independent variable should be a vector, that way you will have multiple values for the dependent variable. This way you plot the function directly This is what will be shown in the command window: 15

16 However, the above option does not allow you to control the plot options to its best. My recommended choice (this option is explained with details in section of the book) is to use the function to create your own dependent variable vector and then plot using the plot command instead. See the example below that shows how to do (the changes are done only in the main file, this is one way to do it). This option uses the for loop without modifying the function file This option uses element by element operation and both the function file and m.file need to be modified as shown: Function file: Notice the element by element operation used here 16

17 This is the m.file using the new function Because element by element operation is used in the function file a for loop is not needed in the main program If you run the program this is what will be shown in the screen (either option): The points are not smooth because more points are needed 17

18 If you want to add more points modify the main program as shown (you don t need to modify the function file, use the function files that uses the element by element operator: Need to create more points in the x vector This is how your plot will look like now, because you have more points in the x vector: 18

19 Using the Pause Command If you are creating a plot as part of a larger Matlab program, you may want the program to create the plot and then wait for you to examine it before proceeding. This is done using the pause command after the plot command. After creating the figure, Matlab will wait until any key is hit before continuing. ===================================================================== Congratulations! You know now how to make plots in Matlab. Need to follow the instructions given in H3:Quality Plots in addition to what you learned from this tutorial Matlab has many other options, you can learn them using the help command for plots 19

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 4 Visualising Data Dr Richard Greenaway 4 Visualising Data 4.1 Simple Data Plotting You should now be familiar with the plot function which is

More information

Classes 7-8 (4 hours). Graphics in Matlab.

Classes 7-8 (4 hours). Graphics in Matlab. Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as Geog 271 Geographic Data Analysis Fall 2015 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found

More information

Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.

Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as Geog 271 Geographic Data Analysis Fall 2017 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found

More information

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed. Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.

More information

INC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1

INC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 INC151 Electrical Engineering Software Practice MATLAB Graphics Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 Graphical display is one of MATLAB s greatest strengths and most

More information

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

Prof. Manoochehr Shirzaei. RaTlab.asu.edu RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files

More information

Additional Plot Types and Plot Formatting

Additional Plot Types and Plot Formatting Additional Plot Types and Plot Formatting The xy plot is the most commonly used plot type in MAT- LAB Engineers frequently plot either a measured or calculated dependent variable, say y, versus an independent

More information

Basic Graphs. Dmitry Adamskiy 16 November 2011

Basic Graphs. Dmitry Adamskiy 16 November 2011 Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken

More information

Matlab Tutorial 1: Working with variables, arrays, and plotting

Matlab Tutorial 1: Working with variables, arrays, and plotting Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.

More information

Dr. Iyad Jafar. Adapted from the publisher slides

Dr. Iyad Jafar. Adapted from the publisher slides Computer Applications Lab Lab 6 Plotting Chapter 5 Sections 1,2,3,8 Dr. Iyad Jafar Adapted from the publisher slides Outline xy Plotting Functions Subplots Special Plot Types Three-Dimensional Plotting

More information

PROGRAMMING WITH MATLAB WEEK 6

PROGRAMMING WITH MATLAB WEEK 6 PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines

More information

fplot Syntax Description Examples Plot Symbolic Expression Plot symbolic expression or function fplot(f) fplot(f,[xmin xmax])

fplot Syntax Description Examples Plot Symbolic Expression Plot symbolic expression or function fplot(f) fplot(f,[xmin xmax]) fplot Plot symbolic expression or function Syntax fplot(f) fplot(f,[xmin xmax]) fplot(xt,yt) fplot(xt,yt,[tmin tmax]) fplot(,linespec) fplot(,name,value) fplot(ax, ) fp = fplot( ) Description fplot(f)

More information

Mechanical Engineering Department Second Year (2015)

Mechanical Engineering Department Second Year (2015) Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

Graphics Example a final product:

Graphics Example a final product: Basic 2D Graphics 1 Graphics Example a final product: TITLE LEGEND YLABEL TEXT or GTEXT CURVES XLABEL 2 2-D Plotting Specify x-data and/or y-data Specify color, line style and marker symbol (Default values

More information

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D

More information

MATLAB Introduction to MATLAB Programming

MATLAB Introduction to MATLAB Programming MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed

More information

This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in

This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in subsequent modules to help to teach research related concepts

More information

PART 1 PROGRAMMING WITH MATHLAB

PART 1 PROGRAMMING WITH MATHLAB PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment

More information

MATLAB Guide to Fibonacci Numbers

MATLAB Guide to Fibonacci Numbers MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author

More information

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving Excel Tutorial VIII

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving Excel Tutorial VIII Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving Excel Tutorial VIII EXCEL Basics (last updated 4/12/06 by GGB) Objectives: These tutorials are designed to

More information

Creating a Basic Chart in Excel 2007

Creating a Basic Chart in Excel 2007 Creating a Basic Chart in Excel 2007 A chart is a pictorial representation of the data you enter in a worksheet. Often, a chart can be a more descriptive way of representing your data. As a result, those

More information

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB 1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)

More information

Introduction to MATLAB

Introduction to MATLAB 58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help

More information

Introduction to Matlab

Introduction to Matlab What is Matlab? Introduction to Matlab Matlab is software written by a company called The Mathworks (mathworks.com), and was first created in 1984 to be a nice front end to the numerical routines created

More information

APPM 2460 PLOTTING IN MATLAB

APPM 2460 PLOTTING IN MATLAB APPM 2460 PLOTTING IN MATLAB. Introduction Matlab is great at crunching numbers, and one of the fundamental ways that we understand the output of this number-crunching is through visualization, or plots.

More information

Getting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text

Getting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go

More information

2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command...

2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command... Contents 2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command... 9 2D LINE PLOTS One of the benefits of programming in MATLAB

More information

Computer Programming in MATLAB

Computer Programming in MATLAB Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in

More information

Graphics and plotting techniques

Graphics and plotting techniques Davies: Computer Vision, 5 th edition, online materials Matlab Tutorial 5 1 Graphics and plotting techniques 1. Introduction The purpose of this tutorial is to outline the basics of graphics and plotting

More information

INTRODUCTION TO MATLAB

INTRODUCTION TO MATLAB 1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Violeta Ivanova, Ph.D. MIT Academic Computing violeta@mit.edu http://web.mit.edu/violeta/www/iap2006 Topics MATLAB Interface and Basics Linear Algebra and Calculus Graphics Programming

More information

GUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot

GUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot MATLAB Function Reference plot 2-D line plot GUI Alternatives Use the Plot Selector to graph selected variables in the Workspace Browser and the Plot Catalog, accessed from the Figure Palette. Directly

More information

0 Graphical Analysis Use of Excel

0 Graphical Analysis Use of Excel Lab 0 Graphical Analysis Use of Excel What You Need To Know: This lab is to familiarize you with the graphing ability of excels. You will be plotting data set, curve fitting and using error bars on the

More information

Chapter 2. MATLAB Fundamentals

Chapter 2. MATLAB Fundamentals Chapter 2. MATLAB Fundamentals Choi Hae Jin Chapter Objectives q Learning how real and complex numbers are assigned to variables. q Learning how vectors and matrices are assigned values using simple assignment,

More information

Introduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College

Introduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................

More information

Getting Started with MATLAB

Getting Started with MATLAB Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as

More information

STAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006

STAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006 STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics

More information

Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures

Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures Matlab is flexible enough to let you quickly visualize data, and

More information

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP) Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal

More information

Purpose of the lecture MATLAB MATLAB

Purpose of the lecture MATLAB MATLAB Purpose of the lecture MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course This lecture contains a short introduction to the MATLAB For further details see other sources

More information

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below. Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you

More information

Lecturer: Keyvan Dehmamy

Lecturer: Keyvan Dehmamy MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications

More information

MATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University

MATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &

More information

The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development

The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Chapter 7 Graphics Learning outcomes Label your plots Create different

More information

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018) Introduction to MATLAB Programming Chapter 3 Linguaggio Programmazione Matlab-Simulink (2017/2018) Algorithms An algorithm is the sequence of steps needed to solve a problem Top-down design approach to

More information

Computational Foundations of Cognitive Science. Inverse. Inverse. Inverse Determinant

Computational Foundations of Cognitive Science. Inverse. Inverse. Inverse Determinant Computational Foundations of Cognitive Science Lecture 14: s and in Matlab; Plotting and Graphics Frank Keller School of Informatics University of Edinburgh keller@inf.ed.ac.uk February 23, 21 1 2 3 Reading:

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

More information

Programming in Mathematics. Mili I. Shah

Programming in Mathematics. Mili I. Shah Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window

More information

FF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini

FF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini FF505/FY505 Computational Science MATLAB Marco Chiarandini (marco@imada.sdu.dk) Department of Mathematics and Computer Science (IMADA) University of Southern Denmark Outline 1. 2D Plots 3D Plots 2 Outline

More information

Introduction to MATLAB: Graphics

Introduction to MATLAB: Graphics Introduction to MATLAB: Graphics Eduardo Rossi University of Pavia erossi@eco.unipv.it September 2014 Rossi Introduction to MATLAB Financial Econometrics - 2014 1 / 14 2-D Plot The command plot provides

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing

More information

Math 7 Elementary Linear Algebra PLOTS and ROTATIONS

Math 7 Elementary Linear Algebra PLOTS and ROTATIONS Spring 2007 PLOTTING LINE SEGMENTS Math 7 Elementary Linear Algebra PLOTS and ROTATIONS Example 1: Suppose you wish to use MatLab to plot a line segment connecting two points in the xy-plane. Recall that

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Violeta Ivanova, Ph.D. Office for Educational Innovation & Technology violeta@mit.edu http://web.mit.edu/violeta/www Topics MATLAB Interface and Basics Calculus, Linear Algebra,

More information

ENV Laboratory 2: Graphing

ENV Laboratory 2: Graphing Name: Date: Introduction It is often said that a picture is worth 1,000 words, or for scientists we might rephrase it to say that a graph is worth 1,000 words. Graphs are most often used to express data

More information

SciGraphica. Tutorial Manual - Tutorials 1and 2 Version 0.8.0

SciGraphica. Tutorial Manual - Tutorials 1and 2 Version 0.8.0 SciGraphica Tutorial Manual - Tutorials 1and 2 Version 0.8.0 Copyright (c) 2001 the SciGraphica documentation group Permission is granted to copy, distribute and/or modify this document under the terms

More information

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB? Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system

More information

Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data

Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data The following table shows the raw data which you need to fit to an appropriate equation k (s -1 ) T (K) 0.00043 312.5 0.00103 318.47 0.0018

More information

1. Register an account on: using your Oxford address

1. Register an account on:   using your Oxford  address 1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation

More information

Introduction to Simulink

Introduction to Simulink Introduction to Simulink There are several computer packages for finding solutions of differential equations, such as Maple, Mathematica, Maxima, MATLAB, etc. These systems provide both symbolic and numeric

More information

2 Amazingly Simple Example Suppose we wanted to represent the following matrix 2 itchy = To enter itchy in Matla

2 Amazingly Simple Example Suppose we wanted to represent the following matrix 2 itchy = To enter itchy in Matla Superlative-Laced Matlab Help for ECE155 Students Brian Kurkoski kurkoski@ucsd.edu October 13, 1999 This document is an introduction to Matlab for ECE155 students. It emphasizes the aspects of Matlab that

More information

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations

More information

Microsoft Excel 2007

Microsoft Excel 2007 Microsoft Excel 2007 1 Excel is Microsoft s Spreadsheet program. Spreadsheets are often used as a method of displaying and manipulating groups of data in an effective manner. It was originally created

More information

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.

More information

Interactive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University

Interactive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems

More information

MATLAB. Input/Output. CS101 lec

MATLAB. Input/Output. CS101 lec MATLAB CS101 lec24 Input/Output 2018-04-18 MATLAB Review MATLAB Review Question ( 1 2 3 4 5 6 ) How do we access 6 in this array? A A(2,1) B A(1,2) C A(3,2) D A(2,3) MATLAB Review Question ( 1 2 3 4 5

More information

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful

More information

MATLAB Tutorial III Variables, Files, Advanced Plotting

MATLAB Tutorial III Variables, Files, Advanced Plotting MATLAB Tutorial III Variables, Files, Advanced Plotting A. Dealing with Variables (Arrays and Matrices) Here's a short tutorial on working with variables, taken from the book, Getting Started in Matlab.

More information

); and XSCALE=4 is a probability scale (distance in plot is related to erf 1 (x)).

); and XSCALE=4 is a probability scale (distance in plot is related to erf 1 (x)). Appendix B: plot plot is a general purpose, advanced plotting program. plot can be frustrating to use because it assumes you know what you want to do and actually mean what you say so if you don t know

More information

Dealing with Data in Excel 2013/2016

Dealing with Data in Excel 2013/2016 Dealing with Data in Excel 2013/2016 Excel provides the ability to do computations and graphing of data. Here we provide the basics and some advanced capabilities available in Excel that are useful for

More information

How to Make Graphs with Excel 2007

How to Make Graphs with Excel 2007 Appendix A How to Make Graphs with Excel 2007 A.1 Introduction This is a quick-and-dirty tutorial to teach you the basics of graph creation and formatting in Microsoft Excel. Many of the tasks that you

More information

GRAPHICS AND VISUALISATION WITH MATLAB

GRAPHICS AND VISUALISATION WITH MATLAB GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab

More information

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar

More information

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting EGR 102 Introduction to Engineering Modeling Lab 05B Plotting 1 Overview Plotting in MATLAB 2D plotting ( ezplot(), fplot(), plot()) Formatting of 2D plots 3D plotting (surf(), mesh(), plot3()) Formatting

More information

Technology Assignment: Limits at Infinity

Technology Assignment: Limits at Infinity The goal of this technology assignment is to find the location of the horizontal asymptote for your model from Technology Assignment: Rational Model. You will produce a graph similar to the one below.

More information

Chemistry 1A Graphing Tutorial CSUS Department of Chemistry

Chemistry 1A Graphing Tutorial CSUS Department of Chemistry Chemistry 1A Graphing Tutorial CSUS Department of Chemistry Please go to the Lab webpage to download your own copy for reference. 1 When you open Microsoft Excel 2003, you will see a blank worksheet: Enter

More information

18.02 Multivariable Calculus Fall 2007

18.02 Multivariable Calculus Fall 2007 MIT OpenCourseWare http://ocw.mit.edu 18.02 Multivariable Calculus Fall 2007 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.02 Problem Set 4 Due Thursday

More information

Starting a New Matlab m.file. Matlab m.files. Matlab m.file Editor/Debugger. The clear all Command. Our Program So Far

Starting a New Matlab m.file. Matlab m.files. Matlab m.file Editor/Debugger. The clear all Command. Our Program So Far Matlab m.files It is not very convenient to do work directly in the Matlab Command Line Window since: It is hard to remember what we typed. It is hard to edit. It all disappears when we close Matlab. Solution:

More information

Introduction to the MATLAB SIMULINK Program

Introduction to the MATLAB SIMULINK Program Introduction to the MATLAB SIMULINK Program Adapted from similar document by Dept. of Chemical Engineering, UC - Santa Barbara MATLAB, which stands for MATrix LABoratory, is a technical computing environment

More information

ME422 Mechanical Control Systems Matlab/Simulink Hints and Tips

ME422 Mechanical Control Systems Matlab/Simulink Hints and Tips Cal Poly San Luis Obispo Mechanical Engineering ME Mechanical Control Systems Matlab/Simulink Hints and Tips Ridgely/Owen, last update Jan Building A Model The way in which we construct models for analyzing

More information

Chemistry Excel. Microsoft 2007

Chemistry Excel. Microsoft 2007 Chemistry Excel Microsoft 2007 This workshop is designed to show you several functionalities of Microsoft Excel 2007 and particularly how it applies to your chemistry course. In this workshop, you will

More information

Lecture 6: Plotting in MATLAB

Lecture 6: Plotting in MATLAB Lecture 6: Plotting in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE21: Computer Applications. See Textbook Chapter 5. A picture is worth a thousand words MATLAB allows

More information

NENS 230 Assignment 4: Data Visualization

NENS 230 Assignment 4: Data Visualization NENS 230 Assignment 4: Data Visualization Due date: Tuesday, October 20, 2015 Goals Get comfortable manipulating figures Familiarize yourself with common 2D and 3D plots Understand how color and colormaps

More information

CSE 123. Plots in MATLAB

CSE 123. Plots in MATLAB CSE 123 Plots in MATLAB Easiest way to plot Syntax: ezplot(fun) ezplot(fun,[min,max]) ezplot(fun2) ezplot(fun2,[xmin,xmax,ymin,ymax]) ezplot(fun) plots the expression fun(x) over the default domain -2pi

More information

TikZ & PGF(plots) Daniel Knittl-Frank. May This work is licensed under the Creative Commons Attribution-ShareAlike 3.

TikZ & PGF(plots) Daniel Knittl-Frank. May This work is licensed under the Creative Commons Attribution-ShareAlike 3. TikZ & PGF(plots) Daniel Knittl-Frank May 2015 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Austria license (CC-BY-SA) 2D value plot Bitstamp USD 20,000 Weighted Price High

More information

MATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations

MATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding

More information

EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson

EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson February 12, 2008 Getting help 1. Local On-line help (a) text-based help: >> help (b) GUI-help >> helpwin (c) Browser-based

More information

INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES

INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES Eric Peasley, Department of Engineering Science, University of Oxford version 4.6, 2018 MATLAB Application Exercises In these exercises you will

More information

Basic Beginners Introduction to plotting in Python

Basic Beginners Introduction to plotting in Python Basic Beginners Introduction to plotting in Python Sarah Blyth July 23, 2009 1 Introduction Welcome to a very short introduction on getting started with plotting in Python! I would highly recommend that

More information

Introduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons

Introduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons Introduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons The Inkscape Program Inkscape is a free, but very powerful vector graphics program. Available for all computer formats

More information

QUICK INTRODUCTION TO MATLAB PART I

QUICK INTRODUCTION TO MATLAB PART I QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems

More information

6 Using Technology Wisely

6 Using Technology Wisely 6 Using Technology Wisely Concepts: Advantages and Disadvantages of Graphing Calculators How Do Calculators Sketch Graphs? When Do Calculators Produce Incorrect Graphs? The Greatest Integer Function Graphing

More information

Charts in Excel 2003

Charts in Excel 2003 Charts in Excel 2003 Contents Introduction Charts in Excel 2003...1 Part 1: Generating a Basic Chart...1 Part 2: Adding Another Data Series...3 Part 3: Other Handy Options...5 Introduction Charts in Excel

More information

ERP Data Analysis Part III: Figures and Movies

ERP Data Analysis Part III: Figures and Movies ERP Data Analysis Part III: Figures and Movies Congratulations, you ve found significant results! Or maybe you haven t and just wanted to show that your data can make really nice pictures that may show

More information

PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING "CIPM 2017" Matlab Fun - 2

PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING CIPM 2017 Matlab Fun - 2 Table of Contents PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING "CIPM 2017" - 2 What? Matlab can be fun... 1 Plot the Sine Function...

More information

MATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting

MATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting MATLAB Laboratory 09/23/10 Lecture Chapters 5 and 9: Plotting Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 09/23/10 Lecture

More information

Chapter 3: Introduction to MATLAB Programming (4 th ed.)

Chapter 3: Introduction to MATLAB Programming (4 th ed.) Chapter 3: Introduction to MATLAB Programming (4 th ed.) Algorithms MATLAB scripts Input / Output o disp versus fprintf Graphs Read and write variables (.mat files) User-defined Functions o Definition

More information