MA/CS375 Fall 2002 1 MA/CS 375 Fall 2002 Lecture 4.

Slides:



Advertisements
Similar presentations
Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Advertisements

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.
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.
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 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.
MATLAB GRAPHICS 2-D.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/27/2003.
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
Chapter 2 MATLAB Fundamentals.
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
Introduction to Matlab Tutorial for CS4MN3/SE3X03 Wen Yu McMaster University.
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.
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,
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.
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.
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()
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
Graphing Guidelines  Often the goal of an experiment is to find the relationship between two variables.  As one variable changes, so does the other.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
S5-1 ADM740, Section 5, June 2007 Copyright  2007 MSC.Software Corporation SECTION 5 PLOT CONFIGURATION FILES.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Designing Effective Graphics Using MATLAB The Cain Project in Engineering and Professional Communication Linda Driskill, Gang Cheng,
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.
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.
Introduction to Scientific Programming in MATLAB Michael McLennan Software Architect HUBzero™ Platform for Scientific Collaboration.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
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.
Title of Poster (Poster template) Authors’ names (underline presenting author) Affiliations Put a picture of the presenter (which may not be the lead author)
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.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 5.
CS100A, Fall 1998, Lecture 191 CS100A, Fall 1998 Lecture 19, Thursday Nov 05 Matlab Concepts: Matlab arrays Matlab subscripting Matlab plotting.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
Outline What is MATLAB MATLAB desktop Variables, Vectors and Matrices Matrix operations Array operations Built-in functions: Scalar, Vector, Matrix Data.
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.
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.
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
MATLAB How to use (using M-files)
Introduction to MATLAB Plotting LAB 3
Introduction to MATLAB
Plotting Signals in MATLAB
Introduction to Matlab
Presentation transcript:

MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4

MA/CS375 Fall Plotting in Matlab

MA/CS375 Fall Example 5 (building and plotting a function of a vector) 1)create a vector x, with 50 equally spaced entries from 0 to 1.0 2)create a vector f, with entries of cosine evaluated at entries of 2*pi*x 3)plot f as a function of x, using + symbols

MA/CS375 Fall Example 5 (figure created by Matlab)

MA/CS375 Fall Example 5 (building and plotting a function of a vector) 1)create a vector x, with 50 equally spaced entries from 0 to 1.0 2)create a vector f, with entries of cos evaluated at entries of x 3)plot f as a function of x, using a blue line

MA/CS375 Fall Example 5 (figure created by Matlab)

MA/CS375 Fall Example 6 (building and plotting two functions of a vector) 1)create a vector x, with 50 entries from 0.0 to 1.0 2)create a vector f, with cos(2*pi*x). 3)create a vector g with entries sin(2*pi*x) 4)plot f as a function of x, using a blue line 5)on same graph plot g as a function of x, using red + symbols.

MA/CS375 Fall Example 6

MA/CS375 Fall Close Up of Example 6 code Instruct Matlab to keep the current graph window and its contents for the next plot.

MA/CS375 Fall Close Up of Example 6 code Instruct Matlab that you have finished plotting in the current graph window.

MA/CS375 Fall Quick Reference For Plot (Taken from Matlab: > help plot) Various line types, plot symbols and colors may be obtained with PLOT(X,Y,S) where S is a character string made from one element from any or all the following 3 colunms: y yellow. point - solid m magenta o circle: dotted c cyan x x-mark-. dashdot r red + plus -- dashed g green* star b blues square w white d diamond k black v triangle (down) ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram

MA/CS375 Fall Adding a Title, Labeling Axes and Legends Ok – so we have made a cool graph But it isn’t much use to anybody else unless you label everything in sight! The following functions will modify the current figure: title, xlabel, ylabel, legend

MA/CS375 Fall Example 7 The label commands

MA/CS375 Fall Details: Set up the legend box with descriptions of each curve: >> legend('f=cos(2*pi*x)', 'g=sin(2*pi*x)'); Label the axis >> xlabel('x'); Label the y-axis >> ylabel('f,g'); Give the graph a title >> title('The very boring graphs');

MA/CS375 Fall

MA/CS375 Fall Modifying the Figure Properties So I am not so pleased by the default fonts used by Matlab. It is easy to change the font: In the figure window click on the text object you wish to change

MA/CS375 Fall

MA/CS375 Fall Click on “Edit/Current Object Properties”

MA/CS375 Fall I prefer a larger Arial font

MA/CS375 Fall

MA/CS375 Fall The Final Product

MA/CS375 Fall Alternative Ways To Change Fonts..

MA/CS375 Fall

MA/CS375 Fall Individual Exercise 1)Create two curves on the same graph: F = 1/(1+x^2) G = exp(x^3) 2)Plot the points at 33 points equally spaced between 0 and 1 3)Use black *’s for F and green o’s for G 4)Label the horizontal and vertical axes 5)Create a title (including your name) 6)Create a legend 7)Make sure the font’s are legible for my old eyes (also figure out how to change the axis fonts) 8)Print out your graph and hand it in.

MA/CS375 Fall Plotting Two-Dimensional Data

MA/CS375 Fall Example 7 (Plotting Two-dimensional Data) 1)create two vectors x1d and y1d, with 20 entries from 0.0 to 1.0 2)create matrices of values using the x1d and y1d to distribute points in the unit square with 20 points in the x and y directions. 3)plot results in a graph.

MA/CS375 Fall Results From Example 7

MA/CS375 Fall Where are we going with this? We can evaluate a function at the two dimensional points (x2d,y2d) We can plot contours of this function where: a contour is a curve in the domain of the function where the value of the function is constant.

MA/CS375 Fall Example 8 (plotting contours of a two-dimensional function)

MA/CS375 Fall Example 9 (plotting two-dimensional function as a surface)

MA/CS375 Fall Example 9 cont. (plotting two-dimensional function as a smooth surface)

MA/CS375 Fall Summary of Lecture 4 We have learnt how to: – plot a graph – plot multiple graphs in the same window – improve the fonts – label everything in sight…. – plot contours of a two-dimensional function – plot a two-dimensional function as a surface