ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.

Slides:



Advertisements
Similar presentations
Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Advertisements

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.
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.
1. Overview 2. plot in 2D 3. Plot in 3D 4. Other possible charts 5. Engineers: label your plots! 6. Plots & Polynomial Plotting 11.
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 - 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 332:202 Discrete Mathematics Spring 2007.
Lecture 9 Plotting in 2-D Plotting in 2-D, Plotting Multiple Curves, Plotting with Figures, Plot Settings, Scaling, Legends © 2007 Daniel Valentine. All.
Plotting. Basic Plotting Two vectors of x and y values needed. Vectors need to be of the same length, but not necessarily of the same geometry. For example,
How To Make Graphs in Microsoft Excel Outline Making Bar Graphs Making Scatter Plots – 1 series Making Scatter Plots – Multiple Series.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
Making Tables and Graphs with Excel The Basics. Where do my IV and DV go? Just like you would create a data table on paper, your IV goes in the leftmost.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB AutoCAD Visio Rational Rose Computer Applications in Engineering Design Introductory Lecture LabVIEW PSPICE Orcad.
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 "A picture is worth a thousand words." Graphical representation is useful for: Error detection - you can locate outliers in a dataset, program bugs,
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
EECE 360/460 Matlab Tutorial Jan Outline What is Matlab? What is Matlab? Matlab Interface Matlab Interface Basic Syntax Basic Syntax Plotting Graphs.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
This is what a blank excel workbook looks like. To start there are three separate sheets on which to store data. Down the left side are the ROW labels.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
© 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Creating Charts Lecture 19.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
Barbara/Pratik/Yu. Outline Matlab desktop M-files Variables Arrays Plots.
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.
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)
Spreadsheets III: Layout and Charts Lecture 10, May 8, 2003 Mr. Greg Vogl Management Information Systems I Uganda Martyrs University.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 4: Intro to Plotting Wednesday 10 Sept 2014 EGR 115 Introduction to Computing for Engineers.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
5.7 Use Figures in Three – Dimensional Space Pg.205.
Chapter 4.1: Scatter Plots. Lesson 4.1: Scatter Plots.
EGR 115 Introduction to Computing for Engineers 2D Plotting – Part I Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 2 in MATLAB Topics Covered: 1.More about 2-D plots  Placing multiple.
Making line graphs How are line graphs the same as bar graphs? x- and y-axis Label axes Even spacing Title Use tickmarks.
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.
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.
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.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
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.
3D-Graphs A 3D surface is defined as: z = f(x, y)
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
MatLab – Palm Chapter 5 2-D & 3-D Plots
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 Data with MATLAB
MATLAB How to use (using M-files)
Plotting Signals in MATLAB
Introduction to Matlab
Presentation transcript:

ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files Copy the four Plotx.m files to your Z:\MatLab folder Also, notice the seed file: Chapter 5 Problem 13 START MATLAB

ENG 1181 Two Dimensional Plots in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot() command Plotting multiple graphs in the same plot Formatting plots Two Dimensional Plots / Chapter 5 START MATLAB NOW

ENG 1181 EXAMPLE OF A PLOT Plot the following data in two vectors, Intensity and Distance: % Define the vector Intensity Intensity = [ ]; % Define the vector Distance Distance = [ ]; % Give the plot command plot( Intensity, Distance) Intensity Distance Write a script file with the following commands: Notice comments!

ENG 1181 Changing the plot plot(Intensity, Distance, '-- r * ') Now suppose you want to change the previous plot so that we have a dashed red line with asterisk markers Dashed LineRed Asterisk Markers Called line specifiers Note dashed red line and asterisk markers

ENG 1181 Line Specifiers for the plot( ) command plot(x, y, 'line specifiers') Line StyleSpecifierLine Color SpecifierMarker Type Specifier Solid Dotted Dashed Dash-dot - : Red Green Blue Black rgbkrgbk X-mark Circle Asterisk Point xo*.xo*. These options (and others) can be accessed in the command window by typing: >> help plot

ENG 1181 A formatted 2-D Plot Title y-axis label x-axis label Legend Data symbol Tick-mark axis limits

ENG 1181 Formatting 2-D Plots There are two ways to format plots in MATLAB: 1.Use commands in the script file to create the title, axis labels, legends, etc. 2.Add interactively in the figure window.

ENG 1181 Formatting Commands Adds a title at the top of the plot Adds a label to the x-axis Adds a label to the y-axis Sets min and max limits on the x-axis and y-axis Creates a legend – must be in the same order as the plots were generated. title('string') xlabel('string') ylabel('string') axis( [xmin xmax ymin ymax] ) legend('string1', 'string2', 'string3') Note square brackets and lack of single quotes

ENG 1181 Title of the plot % Define the vector Intensity Intensity = [ ]; % Define the vector Distance Distance = [ ]; % Give the plot command plot(Intensity, Distance, '-- r * ') xlabel('Intensity') ylabel('Distance') title('Intensity vs Distance') legend('Data') Formatting using commands: Example Labels for the axes Create legend What’s wrong here ?Now it is correct! title(' Distance vs Intensity ') Y vs X …. or Y as a function of X, so it should be : Distance vs Intensity

ENG 1181 FORMATTING A PLOT IN THE FIGURE WINDOW Once a figure window is open, the figure can be formatted interactively. Add things via ‘Insert’ menu Click here to start ‘edit plot’ mode to modify any existing feature in the plot Use ‘Edit’ menu to modify ‘axes’ - will also allow adding title

ENG 1181 Plot a Math Function % Define x with spacing of 0.8 x = [-2 : 0.8 : 4]; % Define y y = 3 * x.^3 – 26 * x + 10; % Plot y(x) plot(x, y) Choose a smaller spacing to get a smooth plot. Open Plot2.m: for -2 ≤ x ≤ 4

ENG 1181 Plot2.m: for -2 ≤ x ≤ 4 % Change spacing to 0.01 x = [-2 : 0.01 : 4]; % Define the function y y = 3 * x.^3 – 26 * x + 10; % Plot y(x) plot( x, y ) Plot a Math Function

ENG 1181 Plot multiple functions in the same plot Two Methods: 1.Use the plot( ) command. 2.Use the hold on and hold off commands.

ENG 1181 Controlling Plots ( called figures ) If you wished to create several plots and not lose previous plots, you can do so as follows: figure(1) plot( Intensity, Distance,'b') figure(2) plot( Intensity, Distance,'--r*') % Both plots will remain until… % You remove figure 2 typing close figure 2 % To remove all remaining figures, type close all