ENG 1181 1 College of Engineering Engineering Education Innovation Center 1 2D Plots 2 in MATLAB Topics Covered: 1.More about 2-D plots  Placing multiple.

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.
2D Plots 1 ENGR 1181 MATLAB 12.
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.
1 Chapter 4 Curve Plotting with MATLAB MATLAB provides some very powerful features for plotting and labeling curves. These operations can be performed.
Introduction to Engineering MATLAB – 10 Plotting - 3 Agenda Special 2-D Plots fplot command.
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.
MATLAB GRAPHICS 2-D.
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 4 Two Dimensional Plots Multiple Plots Plot Formatting Homework.
Introduction to MATLAB for Engineers, Third Edition Chapter 5 Advanced Plotting PowerPoint to accompany Copyright © The McGraw-Hill Companies, Inc.
Plotting - Advanced. FPLOT Plots a function f(x) written as a string within quotation marks. The free variable needs to be designated with x. The lower.
Designing Effective Graphics Using MATLAB The Cain Project in Engineering and Professional Communication ENGINEERING SERIES.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
STATISTICAL GRAPHS.
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.
1 Advanced Plotting ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem
CMPS 1371 Introduction to Computing for Engineers PLOTTING.
1 "A picture is worth a thousand words." Graphical representation is useful for: Error detection - you can locate outliers in a dataset, program bugs,
„  1999 BG Mobasseri1 9/18/2015 June 2 GRAPHICS IN MATLAB- PART I BASIC PLOTTING.
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.
Chapter 7 Polynomial and Rational Functions
Lecture 10 2D plotting & curve fitting Subplots Other 2-D Plots Other 2-D Plots Curve fitting © 2007 Daniel Valentine. All rights reserved. Published by.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5 Advanced.
ES 240: Scientific and Engineering Computation. Chapter 2 Chapter 2: MATLAB Fundamentals Uchechukwu Ofoegbu Temple University.
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.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
ENG College of Engineering Engineering Education Innovation Center 1 More Script Files in MATLAB Script File I/O : Chapter 4 1.Global Variables.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
ENG 1181 College of Engineering Engineering Education Innovation Center P. 1 MAT - Conditional Statements Topics Covered: 1. if based conditional statements.
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and Prof. Steve Chapra, Tufts University All.
MATLAB – PT1 The purpose of this workshop is to get you started and to have fun with MATLAB! Let’s talk a little and decide on what we will be covering.
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
2D Plots 2 ENGR 1181 MATLAB 13. Plotting in the Real World 2D plots generated by MATLAB can be used in a variety of fields, including the one shown here,
Sept. 26, 2005 Lecture 6 - By Paul Lin 1 CPET 190 Lecture 6 Problem Solving with MATLAB
EGR 115 Introduction to Computing for Engineers 2D Plotting – Part I Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers.
ENG College of Engineering Engineering Education Innovation Center 1 Basic For Loops in MATLAB Programming in MATLAB / Chapter 6 Topics Covered:
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
ENG 1181 College of Engineering Engineering Education Innovation Center MatLab – 2D Plots 2 MATLAB has many built-in functions and commands to create various.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
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.
CS100A, Fall 1998, Lecture 191 CS100A, Fall 1998 Lecture 19, Thursday Nov 05 Matlab Concepts: Matlab arrays Matlab subscripting Matlab plotting.
EEE 242 Computer Tools for Electrical Engineering
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.
Session III Plotting in MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU MATLAB Tutorials.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
Plots and Graphics.
Plotting Chapter 5.
Lecture 25.
Ch3 Graphics Overview of Plotting Editing Plots
Lecture 25: Exploring data
Two-Dimensional Plots
Lecture 10 2D plotting & curve fitting
MatLab – 2D Plots 2 MATLAB has many built-in functions and commands to create various types of plots. Instructor notes: We start with an example of some.
Plotting Data with MATLAB
Plotting Multiple Graphs In The Same Plot
Introduction to MATLAB Programming
Plotting Signals in MATLAB
Designing Effective Graphics Using MATLAB
Presentation transcript:

ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 2 in MATLAB Topics Covered: 1.More about 2-D plots  Placing multiple plots on the same page  Special 2-D plots (log axes, special graphics)  The fplot() command Extended Two Dimensional Plots / Chapter 5

ENG subplot(m,n,p)This command creates mxn plots in the Figure Window. The plots are arranged in m rows and n columns. The variable p defines which plot is active. The plots are numbered from 1 to mxn. The upper left plot is 1 and the lower right plot is mxn. The numbers increase from left to right within a row, from the first row to the last. PLOTTING MULTIPLE PLOTS ON ONE PAGE Multiple plots on one page can be created with the subplot command. 130

ENG PLOTTING MULTIPLE PLOTS ON ONE PAGE subplot(3,2,1)subplot(3,2,2) subplot(3,2,3) subplot(3,2,5) subplot(3,2,4) subplot(3,2,6) For example, the command: subplot(3,2,p) Creates 6 plots arranged in 3 rows and 2 columns. 130

ENG EXAMPLE OF MULTIPLE PLOTS ON ONE PAGE The script file of the figure above is shown in the next slide.

ENG % Example of using the subplot command. x1=linspace(1,20,100); y1=sin(x1); subplot(2,3,1) plot(x1,y1) axis([ ]) text(2,1.5,'A plot of sin(x)') y2=sin(x1).^2; subplot(2,3,2) plot(x1,y2) axis([ ]) text(2,1.5,'A plot of sin^2(x)') y3=sin(x1).^3; (The file continues on the next slide) Creating a vector x1 Calculating y1 Creating the first plot Plotting the first plot Formatting the first plot Calculating y2 Creating the second plot Plotting the second plot Calculating y3 Formatting the second plot

ENG subplot(2,3,3) plot(x1,y3) axis([ ]) text(2,1.5,'A plot of sin^3(x)') subplot(2,3,4) fplot('abs(sin(x))',[ ]) text(1,1.5,'A plot of abs(sin(x))') subplot(2,3,5) fplot('sin(x/2)',[ ]) text(1,1.5,'A plot of sin(x/2)') subplot(2,3,6) fplot('sin(x.^1.4)',[ ]) text(1,1.5,'A plot of sin(x^1^.^2)') Creating the third plot Plotting the third plot Formatting the third plot Creating the fourth plot Plotting the fourth plot Formatting the fourth plot Creating the fifth plot Plotting the fifth plot Formatting the fifth plot Plotting the sixth plot Formatting the sixth plot Creating the sixth plot

ENG loglog(x,y)Creates a y vs. x plot with log scale on both axes. semilogx(x,y)Creates a y vs. x plot with log scale on the x axis and linear scale on the y axis. semilogy(x,y)Creates a y vs. x plot with log scale on the y axis. and linear scale on the x axis. PLOTS WITH LOGARITHMIC AXES Plot commands for plots with logarithmic scales:

ENG IMPORTANT FACTS ABOUT LOGARITHMIC PLOTS 1.Negative numbers can not be plotted on log scales (since log of a negative number is not defined). 2.The number zero can not be plotted on a log scale. 3.The tick-mark labels on a log scale are the actual values being plotted (they are not the logarithms of the numbers). 4.Equal distances on a log scale correspond to multiplication by the same constant (in linear scale equal distances correspond to addition of the same constant). 5.Tick marks are not evenly spaced

ENG PLOTTING WITH LINEAR AND LOG SCALES Linear plot(x,y) semilogy(x,y) semilogx(x,y)loglog(x,y) 124 Linear Log Linear Log

ENG bar(x,y)Creates a bar chart of y vs. x. stairs(x,y)Creates a stairs chart of y vs. x. stem(x,y)Creates a stem chart of y vs. x. polar(theta,r)Creates a polar plot. The vectors theta and r contain the polar coordinates  and r, respectively. PLOTS WITH SPECIAL GRAPHICS Commands for plots with special geometry:

ENG SPECIAL PLOTTING FORMATS bar(x,y) stairs(x,y) stem(x,y) polar(theta,radius)

ENG THE fplot COMMAND fplot(‘function’,limits) The fplot command can be used to plot a function with the form: y = f(x)  The function is typed in as a string.  The limits is a vector with the domain of x, and optionally with limits of the y axis: [xmin,xmax] or [xmin,xmax,ymin,ymax]  Line specifiers can be added.

ENG PLOT OF A FUNCTION WITH THE fplot() COMMAND >> fplot('x^2 + 4 * sin(2*x) - 1', [-3 3]) A plot of: