EGR 115 Introduction to Computing for Engineers 2D Plotting – Part I Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers.

Slides:



Advertisements
Similar presentations
Computation for Physics 計算物理概論
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.
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.
Introduction to Engineering MATLAB – 10 Plotting - 3 Agenda Special 2-D Plots fplot command.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/27/2003.
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
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
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 - 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.
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.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 5”
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.
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.
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.
1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.
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.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 4: Intro to Plotting Wednesday 10 Sept 2014 EGR 115 Introduction to Computing for Engineers.
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,
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.
EGR 115 Introduction to Computing for Engineers 2D Plotting – Part II Friday 19 Sept 2014 EGR 115 Introduction to Computing for Engineers.
EGR 115 Introduction to Computing for Engineers Complex Numbers & 3D Plots – Part 1 Wednesday 05 Nov 2014 EGR 115 Introduction to Computing for Engineers.
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.
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.
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,
Plotting. 2 Initializing Vectors colon operator x = 1:2:10 x = y = 0:0.1:0.5 y =
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.
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.
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
EGR 115 Introduction to Computing for Engineers
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
Yang-Ming University, Taipei, Taiwan
Introduction to MATLAB
Plotting Signals in MATLAB
Presentation transcript:

EGR 115 Introduction to Computing for Engineers 2D Plotting – Part I Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers

Lecture Outline Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers 2D Plotting  Additional plotting features Slide 2 of 13

2D Plotting Additional Plotting Features – LineSpec Review Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Review of Line Specifications For Example: >> x=0:0.1:pi; >> plot(x, sin(x), ‘k>:') Line ColorMarker Line Style b blue. point - solid g green o circle : dotted r red x x-mark -. dashdot c cyan + plus -- dashed m magenta * star (none) no line y yellow s square k black d diamond w white v triangle (down) ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram Slide 3 of 13

2D Plotting Additional Plotting Features – Log Scales Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Linear / Linear plot Slide 4 of 13

2D Plotting Additional Plotting Features – Log Scales Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers  A log / linear plot >> semilogx(f, sqrt(G.* conj(G))) >> xlabel('Freq in Hz'); >> ylabel('Attenuation') >> title('Attenuation of a Low-Pass Filter') Cut-off freq of 200 Hz Slide 5 of 13

2D Plotting Additional Plotting Features – Log Scales Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Plot the attenuation in db = 20 log 10 (?)  A log / log plot >> loglog(f, (sqrt(G.* conj(G))).^20) >> xlabel('Freq in Hz'); >> ylabel('Attenuation in db') >> title('Attenuation of a Low-Pass Filter') >> grid Cut-off freq of 200 Hz at -3 db Slide 6 of 13

2D Plotting Additional Plotting Features – Plot Limits Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Controlling the limits for the x and y axes of a plot axis([xminxmaxyminymax]) Sets the limits for thex-andy-axis of the current plot axis tightSets the axis limits to the range of the data axis equal Sets the aspect ratio so that the data units are the same axis offturns off all axis lines, tick marks, and labels axis squaremakes the current axes region square xlim([xminxmax])Sets only the x-axis limitsylim([yminymax])Sets only the y-axis limits Slide 7 of 13

2D Plotting Additional Plotting Features – Plot Limits Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Data units the same i.e., 0.2 in x = 0.2 in y Square aspect ratio Slide 8 of 13

2D Plotting Additional Plotting Features – Left / Right Axis Plots Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Plotting with Both Left and Right Side Axes  A Hwk problem with speed and position (MATLAB code) plotyy(time, height, time, speed) plot(time, height, time, speed) Labeling the right axis can be tricky!! Slide 9 of 13

2D Plotting Additional Plotting Features – Creating Multiple Figures Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Issuing multiple plot commands will result in overwriting the prior plot window:  The “figure” command creates a new plot window >> t = 0:0.1:2*pi; >> plot(t, sin(t), 'b') >> plot(t, cos(t), 'r') Overwrites the Prior Plot >> t = 0:0.1:2*pi; >> figure(1) >> plot(t, sin(t), 'b') >> figure(2) >> plot(t, cos(t), 'r') Creates two Plot Windows Slide 10 of 13

2D Plotting Additional Plotting Features – SubPlots Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers We can also place multiple plots in a single figure:  Subplot(num_rows, num_cols, position) Position#1 Position#2 Position#3Position#4 % An in class example of subplots t = 0:0.1:2*pi; % Array of angles (rad) figure(1); % Open a new figure subplot(2, 2, 1); % Subplot#1 at position 1,1 plot(t, sin(t)); % Plot sin(theta) title('Subplot 1: Sin(\theta)') subplot(2, 2, 2); % Subplot#2 at position 1,2 plot(t, cos(t)); % Plot cos(theta) title('Subplot 2: Cos(\theta)') subplot(2, 2, 3); % Subplot#1 at position 2,1 plot(t, sin(2*t)); % Plot sin(2 theta) title('Subplot 3: Sin(2\theta)') subplot(2, 2, 4); % Subplot#2 at position 2,2 plot(t, cos(2*t)); % Plot cos(2 theta) title('Subplot 4: Cos(2\theta)') Slide 11 of 13

2D Plotting Additional Plotting Features – SubPlots Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Create the following plot: Slide 12 of 13

Next Lecture Wednesday 17 Sept 2014 EGR 115 Introduction to Computing for Engineers Annotation of Plots Polar, Bar, Pie, … Plots Slide 13 of 13