Two-Dimensional Plots

Slides:



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

Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
2D Plots 1 ENGR 1181 MATLAB 12.
1 Chapter 4 Curve Plotting with MATLAB MATLAB provides some very powerful features for plotting and labeling curves. These operations can be performed.
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
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.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 1 in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot()
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.
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.
MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
M ATLAB – What Is It ? Name is from matrix laboratory Powerful tool for – Computation and visualization of engineering and science mathematics – Communication.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 2 in MATLAB Topics Covered: 1.More about 2-D plots  Placing multiple.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
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.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
CS100A, Fall 1998, Lecture 191 CS100A, Fall 1998 Lecture 19, Thursday Nov 05 Matlab Concepts: Matlab arrays Matlab subscripting Matlab plotting.
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
Charts MOAC Lesson 6.
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.
M ATLAB – What Is It ? Name is from matrix laboratory Powerful tool for – Computation and visualization of engineering and science mathematics – Communication.
Chapter 5 EXCEL Graphing Data. Intro In EXCEL graphs are referred to as CHARTS. We will do 2-D graphs known as Scatter Charts or X-Y Charts. Vocabulary:
Plotting in Excel Ken youssefi Engineering 10.
Charts MOAC Lesson 6.
Reading and Writing Image Files
Using Excel to Automate Mundane (Simple) Data Analyses and Matlab to Construct Good-Looking Graphs Anna Fedders Department of Civil and Environmental Engineering,
ECE 1304 Introduction to Electrical and Computer Engineering
Computer Application in Engineering Design
Lecture 25.
Lecture 25: Exploring data
A computer program is a sequence of computer commands.
(Mohammed Sami) Ashhab
Net 222: Communications and networks fundamentals (Practical Part)
Using Excel to Graph Data
Net 222: Communications and networks fundamentals (Practical Part)
Lecture 10 2D plotting & curve fitting
MATLAB How to use (using M-files) Double click this icon
MCE 372 Engineering Analysis
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB How to use (using M-files) Double click this icon
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
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
Charts MOAC Lesson 6.
MATLAB How to use (using M-files)
Chapter2 Creating Arrays
Introduction to MATLAB Programming
Conditional Statements
Plotting Signals in MATLAB
ARRAY DIVISION Identity matrix Islamic University of Gaza
Using Excel to Graph Data
Islamic University of Gaza
Islamic University of Gaza
Using Script Files and Managing Data
Chapter 3 Islamic University of Gaza Faculty of Engineering
Histograms are plots that show the distribution of data.
USING ARRAYS IN MATLAB BUILT-IN MATH FUNCTIONS
Input-Output Stability
Presentation transcript:

Two-Dimensional Plots Islamic University of Gaza Faculty of Engineering Civil Engineering Department Chapter 5 Two-Dimensional Plots Plots are a very useful tool for presenting information. This is true in any field, but especially in science and engineering, where MATLAB is mostly used. Computer Programming Dr.Moayed Almobaied Lecture 12

Islamic University of Gaza Faculty of Engineering Civil Engineering Department MATLAB has many commands that can be used for creating different types of plots. These include standard plots with linear axes, plots with logarithmic and semi-logarithmic axes, three-dimensional contour surface… The plots can be formatted to have a desired appearance. The line type (solid, dashed, etc.), color, and thickness can be prescribed, line markers and grid lines can be added, as can titles and text comments. Computer Programming Computer Programming Dr.Moayed Almobaied Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Several graphs can be created in the same plot, and several plots can be placed on the same page. When a plot contains several graphs and/or data points, a legend can be added to the plot as well. Computer Programming Computer Programming Dr.Moayed Almobaied Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Plot Command The plot command is used to create two-dimensional plots. Islamic University of Gaza Faculty of Engineering Civil Engineering Department Plot Command The plot command is used to create two-dimensional plots. The simplest form of the command is: Computer Programming Computer Programming Dr.Moayed Almobaied Lecture 11

The arguments x and y are each a vector (one-dimensional array). Islamic University of Gaza Faculty of Engineering Civil Engineering Department The arguments x and y are each a vector (one-dimensional array). 2. The two vectors must have the same number of elements. 3. When the plot command is executed, a figure is created in the Figure Window. If not already open, the Figure Window opens automatically when the command is executed. 5. The figure has a single curve with the x values on the horizontal axis and the y values on the vertical axis. Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department 6. The curve is constructed of straight-line segments that connect the points whose coordinates are defined by the elements of the vectors x and y. 7. Each of the vectors, of course, can have any name. The vector that is typed first in the plot command is used for the horizontal axis, and the vector that is typed second is used for the vertical axis. 8. If only one vector is entered as an input argument in the plot command (for example plot (y)) then the figure will show a plot of the values of the elements of the vector ( y(l), y(2), y(3), ... ) versus the element number ( 1, 2, 3, ... ). Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department For example, if a vector x has the elements 1, 2, 3, 5, 7, 7.5, 8, 10, and a vector y has the elements 2, 6.5, 7, 7, 5.5, 4, 6, 8, a simple plot of y versus x can be created by typing the following in the Command Window: Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department The plot appears on the screen in blue, which is the default line color. Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Example: Plot of Given Data Islamic University of Gaza Faculty of Engineering Civil Engineering Department As with any command, the plot command can be typed in the Command Window, or it can be included in a script file. It also can be used in a function file. Example: Plot of Given Data Computer Programming Computer Programming Dr.Moayed Almobaied Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Then a vector y is created with the corresponding values of f(x) by Islamic University of Gaza Faculty of Engineering Civil Engineering Department Plot of Function In order to plot a function y=f(x) with the plot command, the user needs to first create a vector of values of x for the domain over which the function will be plotted. Then a vector y is created with the corresponding values of f(x) by using element-by-element calculations. Example Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department 0.3 instead of 0.01‘with much larger spacing’ the plot that is obtained, gives a distorted picture of the function Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

The Fplot Command Islamic University of Gaza Faculty of Engineering Civil Engineering Department The Fplot Command Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Plotting Multiple Graphs In The Same Plot Islamic University of Gaza Faculty of Engineering Civil Engineering Department Plotting Multiple Graphs In The Same Plot Using the plot Command Computer Programming Computer Programming Dr.Moayed Almobaied Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11

Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming Dr.Moayed Almobaied Computer Programming Lecture 11