EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,

Slides:



Advertisements
Similar presentations
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.
Advertisements

Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Plotting Selim Aksoy Bilkent University Department of Computer Engineering
Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
2D Plots 1 ENGR 1181 MATLAB 12.
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
Matrix Manipulation and 2D Plotting
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
MATLAB GRAPHICS 2-D.
Lesson 6: basic plots. Lesson 6 Outline: Plot 1-basic plot commands 1) Figure Line style Marker style Labels and Titles Axes Matlab help LineSpec (colors,
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
EGR106 Week 5 MATLAB FILES Two Dimensional Plots Multiple Plots Plot Formatting Homework.
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
EGR106 Week 4 Two Dimensional Plots Multiple Plots Plot Formatting Homework.
Lecture 9 Plotting in 2-D Plotting in 2-D, Plotting Multiple Curves, Plotting with Figures, Plot Settings, Scaling, Legends © 2007 Daniel Valentine. All.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
EPSII 59:006 Spring Outline Managing Your Session File Usage  Saving Workspace  Loading Data Files  Creating M-files More on Matrices Review.
MATLAB Fundamentals.
For loop Khairul anwar.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
PLOTS AND FIGURES DAVID COOPER SUMMER Plots One of the primary uses for MATLAB is to be able to create publication quality figures from you data.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 1 in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot()
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5 Advanced.
CMPS 1371 Introduction to Computing for Engineers PLOTTING.
„  1999 BG Mobasseri1 9/18/2015 June 2 GRAPHICS IN MATLAB- PART I BASIC PLOTTING.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 3 : Graphics Edward Cheung Room W311g 2008m.
MATLAB Plotting With MATLAB 1. Two Dimensional Plots The xy plot is the most commonly used plot by engineers The independent variable is usually called.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Barbara/Pratik/Yu. Outline Matlab desktop M-files Variables Arrays Plots.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
Master in Optical Fiber Communications and Photonic Technologies Foundations of Digital Transmission - Fall quarter Introduction to Matlab.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Plot (x-values, y-values) >> x = linspace (-3, 3, 20); >> x = linspace (-3, 3, 20); >> y = 2*x – 1; >> y = 2*x – 1; >> plot (x, y) >> plot (x, y)
UW CSE 190p Section 7/26, Summer 2012 Dun-Yu Hsiao.
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
EGR 115 Introduction to Computing for Engineers 2D Plotting – Part I Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
Introduction to MATLAB ENGR 1181 MATLAB 1. MATLAB Built-in Math Functions  Pre-defined in MATLAB ready for use exp(x) – exponential (e x ) log(x) – natural.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Lab 2 : potting to Matlab Networks.
Plotting. 2 Initializing Vectors colon operator x = 1:2:10 x = y = 0:0.1:0.5 y =
EGR 106 – Week 5 – 2-D Plots Question : Why do engineers use plots? Answer : To analyze, visualize, and present data. Matlab has many useful plotting options.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Prof. N. P. Jadhav Presented by. Overview of MATLAB environment MATLAB is an interactive, matrix-based system for scientific and engineering numeric computation.
Plotting ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Creating a Plot The plot function can take one or more inputs; e.g. plot (x, y) or plot (y) Note that in the two-argument version, the vectors x and.
Plotting Chapter 5.
Lecture 25.
Course Information Do not rely on color to distinguish curves (due to black-white printout). Use different line styles to distinguish curves (solid, dashed,
Lecture 25: Exploring data
Two-Dimensional Plots
Matrices and Arrays.
Net 222: Communications and networks fundamentals (Practical Part)
Net 222: Communications and networks fundamentals (Practical Part)
Net 222: Communications and networks fundamentals (Practical Part)
MATLAB How to use (using M-files) Double click this icon
MATLAB How to use (using M-files) Double click this icon
Plotting Multiple Graphs In The Same Plot
MATLAB How to use (using M-files)
Plotting Signals in MATLAB
Presentation transcript:

EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize, and present their work. Matlab has many useful plotting options available! We’ll review some of them today. Textbook 5.1,

What Would You Rather See? or

Example Problem: x = –3:0.1:3; y = x.^3 – 5*x.^2 + 4; plot(x,y) xlabel( ' value of x ' ) ylabel( ' value of y ' ) title( ' Problem 10 ' ) text(0,1, ' egr106 week 1 ' ) colon and dot notation for arrays standard form for plot annotation tools

scales are automatic default is Figure 1, blue lines, and small text note axis labels & text

Matlab has interactive tools for modifying plots within the Figure window

Click on the arrow to start interaction Double click on some part of the figure to initiate choices

Modify text: Or the lines themselves:

So, the property editor is like a spreadsheet’s tools, but….. – is limited to a single figure – is tedious to repeat for other plots Command line manipulation is available through optional additional arguments: plot(x,y, 'linespec', 'Propname', PropValue ) – line specifiers: color, line type, markers for data – property name and value: thickness, size, etc

Line Specifiers plot(x,y, ' r : d ' ) red dotted line diamonds

General form: plot(x,y, '  ') Color: k black r red b blue g green y yellow c cyan w white m magenta Line type: - solid : dotted -- dashed -. dash-dot Symbol:. point o circle x x-mark s square d diamond etc. The order is not important !

Line Properties and Values plot(x,y, 'linewidth',5 ) line width is 5 “points”

General form: plot(x,y,’  ’,value) Properties: linewidth markersize markeredgecolor markerfacecolor Value: varies with each property sizes in points colors as strings Can have multiple pairs !

Example: plot(x,y, '- k o', 'LineWidth', 3, 'MarkerSize', 6,… 'MarkerEdgeColor','red','MarkerFaceColor','green')

Multiple Plots on the Same Axes Plot allows multiple sets of arrays and line specifiers: Note colors rotate

Can also use hold to freeze the plot Now, note colors

Two Useful Commands figure – alone it opens a new window – figure(n) takes you to window n ginput(1) – creates crosshairs on the screen – returns (x,y) location of cursor at mouse click – ginput(n) returns n pairs of locations

Formatting Plots – Adding Text – xlabel( 'string' ) – ylabel( 'string' ) – title( 'string' ) – text( x, y, 'string' ) – gtext( 'string' ) – cursor controlled – legend( 'string1', … 'stringn', loc) Location where text is started

Can add greek letters, sub and superscripts E.g. gtext( '\beta_1 x^2' )

Text properties allow manipulation of the look for example: gtext( 'cosine', 'fontsize', 20, 'rotation', 45, 'color', 'red', )

Formatting Plots – The Axes Adding a grid grid Setting the axis limits: axis( [ xmin xmax ymin ymax ] )

Example

Can plot on logarithmic axes using: semilogx(x,y) semilogy(x,y) loglog(x,y) Note – negative data is ignored

Figure Files (not in the text) Save to create a.fig file

Figures outside Matlab (not in the text) Print them: Copy for pasting

Multiple Axes in One Figure - Subplot subplot(2,2,1) plot(x1,y1) subplot(2,2,2) etc. Argument list is: rows, columns, choice

Other Types of 2-D Plots - Polar x = 1:100; r = log10(x); t = x/10; polar( t, r ) magnitude angle in radians

Vertical and horizontal bar plots, stem and stair plots, pie and compass plots:

Histograms:

Additional Notes Line specifiers, properties, axis, grid, … work on many of the plot types Most of these tools have additional features – use the help function Three-dimensional plots are available (see chapter 10) with various viewpoint options. Will do these later in semester.

Three-Dim. Examples

For array arguments: plot(x_array, y_array) – plots column by column – cycles through colors For a single argument, plot(x): – plots imaginary versus real if x is complex – plots x versus index if x is real Other Special Cases:

MATALB Allows High Level Interfaces – Graphical User Interfaces (GUI)