MATLAB Basics 6 plotting

Similar documents
Using Matlab SISOTOOL 2016 part 3

Dektak Step by Step Instructions:

There are three categories of unique transitions to choose from, all of which can be found on the Transitions tab:

2 Select the magic wand tool (M) in the toolbox. 3 Click the sky to select that area. Add to the. 4 Click the Quick Mask Mode button(q) in

Handout 1 - Introduction to plots in Matlab 7

2G Video Wall Guide Just Add Power HD over IP Page1 2G VIDEO WALL GUIDE. Revised

Multi-Channel Image. Colour of channel

Bridges and Arches. Authors: André Holleman (Bonhoeffer college, teacher in research at the AMSTEL Institute) André Heck (AMSTEL Institute)

MICROSOFT WORD FEATURES FOR ARTS POSTGRADUATES

PicoScope 6 PC Oscilloscope Software

CHEMISTRY SEMESTER ONE

E X P E R I M E N T 1

Defining and Labeling Circuits and Electrical Phasing in PLS-CADD

TL-2900 AMMONIA & NITRATE ANALYZER DUAL CHANNEL

PHY221 Lab 1 Discovering Motion: Introduction to Logger Pro and the Motion Detector; Motion with Constant Velocity

USER MANUAL FOR DDT 2D. Introduction. Installation. Getting Started. Danley Design Tool 2d. Welcome to the Danley Design Tool 2D program.

Table of Contents Introduction

Case study: how to create a 3D potential scan Nyquist plot?

Chapter 5 Printing with Calc

McIDAS-V Tutorial Using HYDRA to Interrogate Hyperspectral Data updated September 2015 (software version 1.5)

Sampling Worksheet: Rolling Down the River

NOTICE: This document is for use only at UNSW. No copies can be made of this document without the permission of the authors.

Displaying Stationing

PicoScope 6 Training Manual

Sampler Overview. Statistical Demonstration Software Copyright 2007 by Clifford H. Wagner

PCIe: EYE DIAGRAM ANALYSIS IN HYPERLYNX

MODFLOW - Grid Approach

Moving on from MSTAT. March The University of Reading Statistical Services Centre Biometrics Advisory and Support Service to DFID

v. 8.0 GMS 8.0 Tutorial MODFLOW Grid Approach Build a MODFLOW model on a 3D grid Prerequisite Tutorials None Time minutes

HD-SDI Express User Training. J.Egri 4/09 1

EndNote X7: the basics (downloadable desktop version)

TOMELLERI ENGINEERING MEASURING SYSTEMS. TUBO Version 7.2 Software Manual rev.0

Please feel free to download the Demo application software from analogarts.com to help you follow this seminar.

Blueline, Linefree, Accuracy Ratio, & Moving Absolute Mean Ratio Charts

Doubletalk Detection

Graphical User Interface for Modifying Structables and their Mosaic Plots

Import and quantification of a micro titer plate image

Cisco Spectrum Expert Software Overview

NENS 230 Assignment #2 Data Import, Manipulation, and Basic Plotting

PicoScope 6 Beta. PC Oscilloscope Software. User's Guide. psw.beta.en r35 Copyright Pico Technology Ltd. All rights reserved.

ENTSOG Professional Data Warehouse System Documentation Transparency Platform User manual

Lab experience 1: Introduction to LabView

Using different reference quantities in ArtemiS SUITE

PS User Guide Series Seismic-Data Display

Pictures To Exe Version 5.0 A USER GUIDE. By Lin Evans And Jeff Evans (Appendix F By Ray Waddington)

GLog Users Manual.

ebrary Ebooks We have two electronic book databases, ebrary and EBSCOhost Ebooks.

Time series analysis

ME EN 363 ELEMENTARY INSTRUMENTATION Lab: Basic Lab Instruments and Data Acquisition

KRAMER ELECTRONICS LTD. USER MANUAL

Tutorial 3 Normalize step-cycles, average waveform amplitude and the Layout program

Capstone Experiment Setups & Procedures PHYS 1111L/2211L

Word Tutorial 2: Editing and Formatting a Document

Navigate to the Journal Profile page

InPlace User Guide for Faculty of Arts, Education and Social Sciences Staff

7thSense Design Delta Media Server

SIDRA INTERSECTION 8.0 UPDATE HISTORY

A BEGINNER'S GUIDE TO ENDNOTE ONLINE

GS122-2L. About the speakers:

ACCESS ONLINE BOOKING GUIDE

Channel calculation with a Calculation Project

SEM- EDS Instruction Manual

Log viewer and analyser for switchboard and downhole sensor

QCTool. PetRos EiKon Incorporated

PicoScope 6. PC Oscilloscope Software. User's Guide. psw.en r37 Copyright Pico Technology Ltd. All rights reserved.

Adapting PV*SOL for the UK Feed-In and Export Tariffs

MultiSpec Tutorial: Visualizing Growing Degree Day (GDD) Images. In this tutorial, the MultiSpec image processing software will be used to:

Creating Licks Using Virtual Trumpet

MIS 0855 Data Science (Section 005) Fall 2016 In-Class Exercise (Week 6) Advanced Data Visualization with Tableau

USING MATLAB CODE FOR RADAR SIGNAL PROCESSING. EEC 134B Winter 2016 Amanda Williams Team Hertz

Video Effects Processor - VSL 201

System Requirements SA0314 Spectrum analyzer:

Husky Stadium CLUB HUSKY Seat Selection Instruction Manual

SIGVIEW v2.6 User Manual

PCASP-X2 Module Manual

User s Manual. Log Scale (/LG) GX10/GX20/GP10/GP20/GM10 IM 04L51B01-06EN. 2nd Edition

Setting Up the Warp System File: Warp Theater Set-up.doc 25 MAY 04

Serial Decode I2C TEN MINUTE TUTORIAL. December 21, 2011

Quick Guide Book of Sending and receiving card

AmbDec User Manual. Fons Adriaensen

set. Important Note: the system must be calibrated before meaningful quant results can be obtained!

READ THIS FIRST. Morphologi G3. Quick Start Guide. MAN0412 Issue1.1

EndNote Basic Workbook for School of Management

Mackie Control and Cubase SX/SL

PicoScope. User guide. Copyright 2005 Pico Technology Limited. All rights reserved. PSW044 v1.5

ECT 224: Digital Computer Fundamentals Digital Circuit Simulation & Timing Analysis

Precautions and Disclaimers What You Can Do with Geometry Manager Pro Check Your Computer System requirements...

For the SIA. Applications of Propagation Delay & Skew tool. Introduction. Theory of Operation. Propagation Delay & Skew Tool

Use xtimecomposer and xscope to trace data in real-time

Using Endnote advanced features

Analyzing Modulated Signals with the V93000 Signal Analyzer Tool. Joe Kelly, Verigy, Inc.

Next Generation Software Solution for Sound Engineering

Xpedition Layout for Package Design. Student Workbook

Task-based Activity Cover Sheet

User Manual VM700T Video Measurement Set Option 30 Component Measurements

User Manual Tonelux Tilt and Tilt Live

Introduction to EndNote Online

USB Mini Spectrum Analyzer User s Guide TSA5G35

Quick-Start for READ30

Getting started with CitNetExplorer version 1.0.0

Transcription:

1 MATLAB Basics 6 plotting Anthony Rossiter University of Sheffield For a neat organisation of all videos and resources http://controleducation.group.shef.ac.uk/indexwebbook.html

Introduction 2 1. The previous videos demonstrate how to use basic MATLAB functionality. 2. It is useful to next to consider how to form plots and graphs which look good and can be exported into reports and other formats. 3. A summary of the main plotting options is given here as more advanced users will easily be able to pursue further options.

List of common plotting options Do your want multiple line plots on the same set of axis? Do you want multiple axis (subfigures) in the same figure window? Change colour, thickness and style of lines plots. Adding labels to axis and a title and changing fontsize. Changing domain and range (equivalently zoom in ). Adding text, arrows, etc. Saving a figure for further edit. Exporting a figure as.eps,.jpg or other form for use outside of MATLAB. Etc. 3

Simple line plot Generate two arrays which have the same length, say x,y, for convenience. The command plot(x,y) will plot x on the horizontal axis against y on the vertical axis. Matches corresponding elements, so [x(1),y(1)], [x(2),y(2)] and so on. (0,-1) (7,1) 4 Default is a line plot joining points

Nominating a figure window 5 It is better to always say which figure window you wish to use or MATLAB will choose the one it thinks is active. figure(1) - next plot statement will use figure 1. figure(4) - next plot statement will use figure 4. If you want the figure window to be clean, use clf which is short for clean figure. This ensures you do not inherit any lines or other information from previous uses of that figure window.

Colours and markers It is easy to control colours and markers should that be desired by adding extra commands to the plot statement. plot(x,y, r ) in red plot(x,y, g ) in green plot(x,y, b+ ) use blue + 6 Use >>help plot to see more options

Adding labels It is important that plots are presented nicely and clearly. Use legend.m to match lines with colours. Use xlabel.m, ylabel.m to mark axis. Use title.m to give a figure title. Experiment with putting in labels of your choice. Use >> help title, and so on to get more detailed help on how to use these labels. We will give some illustrations.

Common functions A typical requirement would be to plot a mathematical function such as: y tan(x) x=-1.5:.02:1.5; %%% define domain y=tan(x); %%% evaluate tangent figure(1); clf reset plot(x,y,'m'); title('tangent curve'); xlabel('x') ylabel('tan(x)') 8 We then want to add labels and a title and a legend.

Common functions A typical requirement would be to plot a mathematical function such as: figure(2); clf reset x2=-3:.1:5; p=poly([-1-2]); %%% p=(x+1)(x+2) px = polyval(p,x2); plot(x2,px,'r:') title(['plot of polynomial with coefficients,num2str(p)]) xlabel('x') ylabel(poly2str(p,'x')) 9 p x 2 3x 2 We then want to add labels and a title and a legend. Line is thin, we could make it thicker!

Overlaying plots 1 It is common to want more than one line plot on the same figure. The easiest way is to compact into a single plot statement. plot(x1,y1, r,x2,y2, b ) figure(3);clf reset plot(x,y,'go-',x2,px,'m--'); name = poly2str(p,'x') %%% Generates string/text of polynomial title(['plot of ',name,' and tan(x)'],'fontsize',18,'color',[.4,.6,.1]) legend('tangent','polynomial') xlabel('x-axis'); ylabel('y-axis'); text(2,-1,'text in the graph') 10 x1,y1 must have same lengths x2,y2 must have same lengths

Hold on and hold off In many cases you may wish to overlay 4,5, 10 or more line plots. Putting these in a single command is clumsy, especially if you want different colours and markers. Also, you may generate a basic figure now and want to add a line plot to it later. The default with plot is to clear existing line plots, but you can override this with the hold on command which instructs MATLAB to add the new line plot to the existing figure. 11

figure(4);clf reset z=linspace(-4,2,200); z2=linspace(-6,1,100); z3=linspace(-3,2,10); plot(z,sin(2*z),'b-','linewidth',2); hold on 3 different domains 1 st plot and then hold on plot(z2,polyval([1 6 11 6]/30,z2),'r:','linewidth',3) plot(z3,z3,'go','markersize',15) title('plot of various functions','fontsize',18) legend('sin(2z)',['(',poly2str([1,6,11,6],'z'),')/30'],'f(z)=z') xlabel('z-axis'); ylabel('f(z)'); Overlaying plots 2 2 nd and 3 rd plots with different properties 12 Automatic generation of a polynomial as a string

It can be awkward at times to construct a plot statement which makes the plot appear the way you want in terms of colours, linewidths, ticks, labels and so forth. MATLAB provides a direct editing window to modify any of these aspects. Property editor Go to view tab and select property editor 13

14 You can save figure as a.fig (for editting later) or other forms for export. Use the mouse to select a line. Right click to access attributes such as line width, colour, etc. A live demonstration will make this clearer.

Subplots Some times you want want several axis on the same figure window. The MATLAB tool for this is subplot. figure(2);clf reset subplot(2,3,4); plot(1:10) subplot(2,3,3); plot(sin(0:.1:3),'r') 15 subplot(2,3,4) Next plot in 4 th position 2 rows of axis 3 columns of axis

Exporting to word or powerpoint 16 Do not use screen capture this is messy as seen here! Go to the edit button and select copy figure. Then simply paste and see the difference!

17 LIVE DEMONSTRATIONS WITH MATLAB Go through the following to see core plotting options and their use matlab_basics6a.m matlab_basics6b.m

Conclusions 18 Demonstrated the ease with which MATLAB can produce good quality plots for display. 1. Easy to control line colours, thickness and marker types. 2. Easy to overlay several line plots. 3. Easy to add labels, titles and legends. 4. Convenient editor for post processing. 5. Easy to save or export into any convenient format.

For a neat organisation of all videos and resources http://controleducation.group.shef.ac.uk/indexwebbook.html Anthony Rossiter Department of Automatic Control and Systems Engineering University of Sheffield www.shef.ac.uk/acse 2016 University of Sheffield This work is licensed under the Creative Commons Attribution 2.0 UK: England & Wales Licence. To view a copy of this licence, visit http://creativecommons.org/licenses/by/2.0/uk/ or send a letter to: Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA. It should be noted that some of the materials contained within this resource are subject to third party rights and any copyright notices must remain with these materials in the event of reuse or repurposing. If there are third party images within the resource please do not remove or alter any of the copyright notices or website details shown below the image. (Please list details of the third party rights contained within this work. If you include your institutions logo on the cover please include reference to the fact that it is a trade mark and all copyright in that image is reserved.)