Introductory Scientific Computing with Python

Size: px
Start display at page:

Download "Introductory Scientific Computing with Python"

Transcription

1 Introductory Scientific Computing with Python Introduction, IPython and Plotting FOSSEE Department of Aerospace Engineering IIT Bombay SciPy India, 2015 December, 2015 FOSSEE group (IIT Bombay) Interactive Plotting 1 / 39

2 Acknowledgement FOSSEE group (fossee.in) based at IIT Bombay and funded by The National Mission on Education through ICT, Ministry of HRD, India FOSSEE group (IIT Bombay) Interactive Plotting 2 / 39

3 Outline Checklist 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 3 / 39

4 Checklist Checklist 1 IPython 2 Editor 3 Data files: pendulum.txt sslc.txt 4 Images bird.png FOSSEE group (IIT Bombay) Interactive Plotting 4 / 39

5 Checklist About the Tutorial Intended Audience Engg., Mathematics and Science researchers with a reasonable programming background. Goal: Successful participants will be able to Start using Python as plotting, computational tool. Use the basic libraries and tools for scientific computing with Python. FOSSEE group (IIT Bombay) Interactive Plotting 5 / 39

6 Outline Starting up IPython 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 6 / 39

7 Starting up IPython Starting up... Terminal $ ipython -pylab # OR $ jupyter console -pylab FOSSEE group (IIT Bombay) Interactive Plotting 7 / 39

8 Starting up IPython Running IPython In []: print("hello, World!") Hello, World! Exiting on the terminal In []: ^D(Ctrl-D) Do you really want to exit([y]/n)? y Or hit Return or Ctrl-D again FOSSEE group (IIT Bombay) Interactive Plotting 8 / 39

9 Outline Breaking out of loops 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 9 / 39

10 Breaking out of loops Breaking out of Loops Breaking out of loops In []: while True:...: print("hello, World!")...: Hello, World! Hello, World!^C(Ctrl-C) KeyboardInterrupt 10 m FOSSEE group (IIT Bombay) Interactive Plotting 10 / 39

11 Outline Plotting 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 11 / 39

12 Outline Plotting Drawing plots 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 12 / 39

13 First Plot Plotting Drawing plots In []: x = linspace(0, 2*pi, 50) In []: plot(x, sin(x)) FOSSEE group (IIT Bombay) Interactive Plotting 13 / 39

14 Walkthrough Plotting Drawing plots x = linspace(start, stop, num) returns num evenly spaced points, in the interval [start, stop]. x[0] = start x[num - 1] = end plot(x, y) plots x and y using default line style and color FOSSEE group (IIT Bombay) Interactive Plotting 14 / 39

15 Outline Plotting Decoration 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 15 / 39

16 Adding Labels Plotting Decoration In []: xlabel( x ) In []: ylabel( sin(x) ) FOSSEE group (IIT Bombay) Interactive Plotting 16 / 39

17 Another example Plotting Decoration In []: clf() Clears the plot area. In []: y = linspace(0, 2*pi, 50) In []: plot(y, sin(2*y)) In []: xlabel( y ) In []: ylabel( sin(2y) ) FOSSEE group (IIT Bombay) Interactive Plotting 17 / 39

18 IPython tips... Plotting Decoration Use TAB to complete command History Accesses history (also from past sessions) Up and down arrows (Ctrl-p/Ctrl-n) Search: Ctrl-r and start typing Ctrl-a: go to start of line Ctrl-e: go to end of line Ctrl-k: kill to end of line FOSSEE group (IIT Bombay) Interactive Plotting 18 / 39

19 Outline Plotting More decoration 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 19 / 39

20 Plotting Title and Legends More decoration In []: title( Sinusoids ) In []: legend([ sin(2y) ]) FOSSEE group (IIT Bombay) Interactive Plotting 20 / 39

21 Plotting Legend Placement More decoration In []: legend([ sin(2y) ], loc = center ) best right center FOSSEE group (IIT Bombay) Interactive Plotting 21 / 39

22 Showing it better Plotting More decoration In []: plot(y, cos(y), r ) In []: clf() In []: plot(y, sin(y), g, linewidth=2) FOSSEE group (IIT Bombay) Interactive Plotting 22 / 39

23 Annotating Plotting More decoration In []: annotate( local max, xy=(1.5, 1)) FOSSEE group (IIT Bombay) Interactive Plotting 23 / 39

24 Saving & Closing Plotting More decoration In []: savefig( sin.png ) In []: close() Supported formats to store images: png eps - Easy to embed in LaTeX files pdf raw rgba svg FOSSEE group (IIT Bombay) Interactive Plotting 24 / 39

25 Outline Multiple plots 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 25 / 39

26 Overlaid Plots Multiple plots In []: clf() In []: plot(y, sin(y)) In []: plot(y, cos(y)) In []: xlabel( y ) In []: ylabel( f(y) ) In []: legend([ sin(y), cos(y) ]) By default plots would be overlaid! FOSSEE group (IIT Bombay) Interactive Plotting 26 / 39

27 Multiple plots Plotting separate figures In []: clf() In []: figure(1) In []: plot(y, sin(y)) In []: figure(2) In []: plot(y, cos(y)) In []: savefig( cosine.png ) In []: figure(1) In []: title( sin(y) ) In []: savefig( sine.png ) In []: close() In []: close() FOSSEE group (IIT Bombay) Interactive Plotting 27 / 39

28 Axes lengths Multiple plots Getting axes lengths In []: xmin, xmax = xlim() In []: ymin, ymax = ylim() In []: print xmin, xmax Set the axes limits In []: xlim(xmin, 2*pi ) In []: ylim(ymin-0.2, ymax+0.2) FOSSEE group (IIT Bombay) Interactive Plotting 28 / 39

29 Axes lengths Multiple plots FOSSEE group (IIT Bombay) Interactive Plotting 29 / 39

30 Multiple plots IPython tips... Try: In []: plot? to get more information on plot Try: In []: plot?? to see the source code for plot Note: exit pager with q or ESC FOSSEE group (IIT Bombay) Interactive Plotting 30 / 39

31 Multiple plots Review Problem 1 Plot x, -x, sin(x), xsin(x) in range 5π to 5π 2 Add a legend 3 Annotate the origin 4 Set axes limits to the range of x FOSSEE group (IIT Bombay) Interactive Plotting 31 / 39

32 Multiple plots Review Problem... Plotting... In []: x = linspace(-5*pi, 5*pi, 500) In []: plot(x, x, b ) In []: plot(x, -x, b ) In []: plot(x, sin(x), g, linewidth=2) In []: plot(x, x*sin(x), r, linewidth=3). FOSSEE group (IIT Bombay) Interactive Plotting 32 / 39

33 Multiple plots Review Problem... Legend & Annotation... In []: legend([ x, -x, sin(x), xsin(x) ]) In []: annotate( origin, xy = (0, 0)) Setting Axes limits... In []: xlim(-5*pi, 5*pi) In []: ylim(-5*pi, 5*pi) FOSSEE group (IIT Bombay) Interactive Plotting 33 / 39

34 Outline Scripts Saving & Running 1 Checklist 2 Starting up IPython 3 Breaking out of loops 4 Plotting Drawing plots Decoration More decoration 5 Multiple plots 6 Scripts Saving & Running FOSSEE group (IIT Bombay) Interactive Plotting 34 / 39

35 Scripts Saving & Running Command History Use the %hist magic command of IPython In []: %hist This displays all the commands typed in so far aka Command History. Careful about errors! %hist will contain the errors as well. Magic Commands? Magic commands are commands provided by IPython to make our life easier. FOSSEE group (IIT Bombay) Interactive Plotting 35 / 39

36 Scripts Saving & Running Command History Use the %hist magic command of IPython In []: %hist This displays all the commands typed in so far aka Command History. Careful about errors! %hist will contain the errors as well. Magic Commands? Magic commands are commands provided by IPython to make our life easier. FOSSEE group (IIT Bombay) Interactive Plotting 35 / 39

37 Scripts Saving & Running Saving commands into script Use the %save magic command of IPython %save script_name line_numbers Line numbers can be specified individually separated by spaces or as a range separated by a dash. %save four_plot.py This saves from the history the commands entered on line numbers 16, 18, 19, 20, FOSSEE group (IIT Bombay) Interactive Plotting 36 / 39

38 Scripts Saving & Running Python Scripts... Now, four_plot.py is called a Python Script. run the script in IPython using %run four_plot.py NameError: name linspace is not defined To avoid this, run using %run -i four_plot.py You may need to do show() to see a plot window FOSSEE group (IIT Bombay) Interactive Plotting 37 / 39

39 Scripts Saving & Running Python Scripts... Now, four_plot.py is called a Python Script. run the script in IPython using %run four_plot.py NameError: name linspace is not defined To avoid this, run using %run -i four_plot.py You may need to do show() to see a plot window FOSSEE group (IIT Bombay) Interactive Plotting 37 / 39

40 Scripts Saving & Running Result graph FOSSEE group (IIT Bombay) Interactive Plotting 38 / 39

41 Scripts Saving & Running What did we learn? Starting up IPython Creating simple plots Adding labels and legends Annotating plots Changing the looks: size, linewidth Accessing history, documentation %hist - History of commands %save - Saving commands Running a script using %run -i 40 m FOSSEE group (IIT Bombay) Interactive Plotting 39 / 39

Introductory Scientific Computing with Python

Introductory Scientific Computing with Python Introductory Scientific Computing with Python More plotting, lists and FOSSEE Department of Aerospace Engineering IIT Bombay SciPy India, 2015 December, 2015 FOSSEE (FOSSEE IITB) Interactive Plotting 1

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as Geog 271 Geographic Data Analysis Fall 2015 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as Geog 271 Geographic Data Analysis Fall 2017 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Violeta Ivanova, Ph.D. Office for Educational Innovation & Technology violeta@mit.edu http://web.mit.edu/violeta/www Topics MATLAB Interface and Basics Calculus, Linear Algebra,

More information

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar

More information

Classes 7-8 (4 hours). Graphics in Matlab.

Classes 7-8 (4 hours). Graphics in Matlab. Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.

More information

Basic Graphs. Dmitry Adamskiy 16 November 2011

Basic Graphs. Dmitry Adamskiy 16 November 2011 Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken

More information

Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.

Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical

More information

W1005 Intro to CS and Programming in MATLAB. Plo9ng & Visualiza?on. Fall 2014 Instructor: Ilia Vovsha. hgp://www.cs.columbia.

W1005 Intro to CS and Programming in MATLAB. Plo9ng & Visualiza?on. Fall 2014 Instructor: Ilia Vovsha. hgp://www.cs.columbia. W1005 Intro to CS and Programming in MATLAB Plo9ng & Visualiza?on Fall 2014 Instructor: Ilia Vovsha hgp://www.cs.columbia.edu/~vovsha/w1005 Outline Plots (2D) Plot proper?es Figures Plots (3D) 2 2D Plots

More information

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB 1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing

More information

APPM 2460 PLOTTING IN MATLAB

APPM 2460 PLOTTING IN MATLAB APPM 2460 PLOTTING IN MATLAB. Introduction Matlab is great at crunching numbers, and one of the fundamental ways that we understand the output of this number-crunching is through visualization, or plots.

More information

Mechanical Engineering Department Second Year (2015)

Mechanical Engineering Department Second Year (2015) Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Violeta Ivanova, Ph.D. MIT Academic Computing violeta@mit.edu http://web.mit.edu/violeta/www/iap2006 Topics MATLAB Interface and Basics Linear Algebra and Calculus Graphics Programming

More information

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb Making Plots with Matlab (last updated 5/29/05 by GGB) Objectives: These tutorials are

More information

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D

More information

Getting Started with MATLAB

Getting Started with MATLAB Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as

More information

Bi 1x Spring 2014: Plotting and linear regression

Bi 1x Spring 2014: Plotting and linear regression Bi 1x Spring 2014: Plotting and linear regression In this tutorial, we will learn some basics of how to plot experimental data. We will also learn how to perform linear regressions to get parameter estimates.

More information

Scientific Python: matplotlib

Scientific Python: matplotlib Scientific Python: matplotlib 17 July 2014 Introduction and Aims This exercise introduces the matplotlib module of Python. Matplotlib is a versatile plotting library that can be used to produce both quick

More information

3D Data visualization with Mayavi and TVTK

3D Data visualization with Mayavi and TVTK 3D Data visualization with Mayavi and TVTK Prabhu Ramachandran Department of Aerospace Engineering IIT Bombay Advanced tutorials at SciPy09 Caltech, Pasadena Aug. 18, 2009 Prabhu Ramachandran (IIT Bombay)

More information

Introduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003

Introduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003 Introduction to MATLAB Computational Probability and Statistics CIS 2033 Section 003 About MATLAB MATLAB (MATrix LABoratory) is a high level language made for: Numerical Computation (Technical computing)

More information

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Introduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018) Introduction to MATLAB Programming Chapter 3 Linguaggio Programmazione Matlab-Simulink (2017/2018) Algorithms An algorithm is the sequence of steps needed to solve a problem Top-down design approach to

More information

Name: INSERT YOUR NAME HERE UWNetID: INSERT YOUR NETID

Name: INSERT YOUR NAME HERE UWNetID: INSERT YOUR NETID AMath 584 Homework 3 Due to dropbox by 6pm PDT, November 4, 2011 Name: INSERT YOUR NAME HERE UWNetID: INSERT YOUR NETID Use latex for this assignment! Submit a pdf file to the dropbox. You do not need

More information

PART 1 PROGRAMMING WITH MATHLAB

PART 1 PROGRAMMING WITH MATHLAB PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment

More information

Graphics Example a final product:

Graphics Example a final product: Basic 2D Graphics 1 Graphics Example a final product: TITLE LEGEND YLABEL TEXT or GTEXT CURVES XLABEL 2 2-D Plotting Specify x-data and/or y-data Specify color, line style and marker symbol (Default values

More information

Math Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...

Math Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs... Introduction to Plotting with Matlab Math Sciences Computing Center University ofwashington September, 1996 Contents Fundamentals........................................... 1 Making Plots...........................................

More information

AMS 27L LAB #2 Winter 2009

AMS 27L LAB #2 Winter 2009 AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles

More information

LECTURE 22. Numerical and Scientific Computing Part 2

LECTURE 22. Numerical and Scientific Computing Part 2 LECTURE 22 Numerical and Scientific Computing Part 2 MATPLOTLIB We re going to continue our discussion of scientific computing with matplotlib. Matplotlib is an incredibly powerful (and beautiful!) 2-D

More information

Computational Programming with Python

Computational Programming with Python Numerical Analysis, Lund University, 2017 1 Computational Programming with Python Lecture 1: First steps - A bit of everything. Numerical Analysis, Lund University Lecturer: Claus Führer, Alexandros Sopasakis

More information

LabVIEW MathScript Quick Reference

LabVIEW MathScript Quick Reference Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics LabVIEW MathScript Quick Reference Hans-Petter Halvorsen, 2012.06.14 Faculty of Technology, Postboks

More information

FF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini

FF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini FF505/FY505 Computational Science MATLAB Marco Chiarandini (marco@imada.sdu.dk) Department of Mathematics and Computer Science (IMADA) University of Southern Denmark Outline 1. 2D Plots 3D Plots 2 Outline

More information

Hello Earth! A grounded introduction to Matlab. Frederik J Simons. Christopher Harig. Adam C. Maloof Princeton University

Hello Earth! A grounded introduction to Matlab. Frederik J Simons. Christopher Harig. Adam C. Maloof Princeton University Hello Earth! A grounded introduction to Matlab Frederik J Simons Christopher Harig Adam C. Maloof Princeton University (Enter teacher) i 2 Something canny Matlab can do i 3 200 400 600 800 1000 100 200

More information

Ch.5: Array computing and curve plotting (Part 1)

Ch.5: Array computing and curve plotting (Part 1) Ch.5: Array computing and curve plotting (Part 1) Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Simula Research Laboratory 1 University of Oslo, Dept. of Informatics 2 Sep 20, 2017 (Adjusted) Plan for

More information

Plotting x-y (2D) and x, y, z (3D) graphs

Plotting x-y (2D) and x, y, z (3D) graphs Tutorial : 5 Date : 9/08/2016 Plotting x-y (2D) and x, y, z (3D) graphs Aim To learn to produce simple 2-Dimensional x-y and 3-Dimensional (x, y, z) graphs using SCILAB. Exercises: 1. Generate a 2D plot

More information

Getting Started with Matlab

Getting Started with Matlab Chapter Getting Started with Matlab The computational examples and exercises in this book have been computed using Matlab, which is an interactive system designed specifically for scientific computation

More information

Getting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text

Getting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 4 Visualising Data Dr Richard Greenaway 4 Visualising Data 4.1 Simple Data Plotting You should now be familiar with the plot function which is

More information

5 File I/O, Plotting with Matplotlib

5 File I/O, Plotting with Matplotlib 5 File I/O, Plotting with Matplotlib Bálint Aradi Course: Scientific Programming / Wissenchaftliches Programmieren (Python) Installing some SciPy stack components We will need several Scipy components

More information

Introduction to Python Practical 1

Introduction to Python Practical 1 Introduction to Python Practical 1 Daniel Carrera & Brian Thorsbro October 2017 1 Introduction I believe that the best way to learn programming is hands on, and I tried to design this practical that way.

More information

Creating Plots with Gnuplot. May 18, 2017

Creating Plots with Gnuplot. May 18, 2017 Creating Plots with Gnuplot May 18, 2017 What is Gnuplot Gnuplot is a freely available command-line based interactive plotting program. $ gnuplot G N U P L O T Version 4.6 patchlevel 0 last modified 2012-03

More information

Part #6. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr

Part #6. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr A0B17MTB Matlab Part #6 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague Learning how to Visualizing in Matlab #1 Debugging

More information

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.

12 whereas if I terminate the expression with a semicolon, the printed output is suppressed. Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.

More information

Episode 1 Using the Interpreter

Episode 1 Using the Interpreter Episode 1 Using the Interpreter Anaconda We recommend, but do not require, the Anaconda distribution from Continuum Analytics (www.continuum.io). An overview is available at https://docs.continuum.io/anaconda.

More information

GUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot

GUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot MATLAB Function Reference plot 2-D line plot GUI Alternatives Use the Plot Selector to graph selected variables in the Workspace Browser and the Plot Catalog, accessed from the Figure Palette. Directly

More information

EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson

EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson February 12, 2008 Getting help 1. Local On-line help (a) text-based help: >> help (b) GUI-help >> helpwin (c) Browser-based

More information

Introduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College

Introduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................

More information

Introduction to MATLAB

Introduction to MATLAB 58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help

More information

Working Environment : Python #1

Working Environment : Python #1 Working Environment : Python #1 Serdar ARITAN Biomechanics Research Group, Faculty of Sports Sciences, and Department of Computer Graphics Hacettepe University, Ankara, Turkey 1 Physics has several aspects:

More information

Dr. Iyad Jafar. Adapted from the publisher slides

Dr. Iyad Jafar. Adapted from the publisher slides Computer Applications Lab Lab 6 Plotting Chapter 5 Sections 1,2,3,8 Dr. Iyad Jafar Adapted from the publisher slides Outline xy Plotting Functions Subplots Special Plot Types Three-Dimensional Plotting

More information

GRAPHICS AND VISUALISATION WITH MATLAB

GRAPHICS AND VISUALISATION WITH MATLAB GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab

More information

Computational Foundations of Cognitive Science. Inverse. Inverse. Inverse Determinant

Computational Foundations of Cognitive Science. Inverse. Inverse. Inverse Determinant Computational Foundations of Cognitive Science Lecture 14: s and in Matlab; Plotting and Graphics Frank Keller School of Informatics University of Edinburgh keller@inf.ed.ac.uk February 23, 21 1 2 3 Reading:

More information

Matlab Tutorial 1: Working with variables, arrays, and plotting

Matlab Tutorial 1: Working with variables, arrays, and plotting Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command...

2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command... Contents 2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command... 9 2D LINE PLOTS One of the benefits of programming in MATLAB

More information

Basic statistical operations

Basic statistical operations COSC 6397 Big Data Analytics Fundamental Analytics Edgar Gabriel Spring 2014 Basic statistical operations Calculating minimum, maximum, mean, median, standard deviation Data typically multi-dimensional

More information

Lecture 3 for Math 398 Section 952: Graphics in Matlab

Lecture 3 for Math 398 Section 952: Graphics in Matlab Lecture 3 for Math 398 Section 952: Graphics in Matlab Thomas Shores Department of Math/Stat University of Nebraska Fall 2002 A good deal of this material comes from the text by Desmond Higman and Nicholas

More information

Complex Dynamic Systems

Complex Dynamic Systems Complex Dynamic Systems Department of Information Engineering and Mathematics University of Siena (Italy) (mocenni at dii.unisi.it) (madeo at dii.unisi.it) (roberto.zingone at unisi.it) Lab Session #5

More information

Introduction to MATLAB Practical 1

Introduction to MATLAB Practical 1 Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior

More information

Chapter 2 Scatter Plots and Introduction to Graphing

Chapter 2 Scatter Plots and Introduction to Graphing Chapter 2 Scatter Plots and Introduction to Graphing 2.1 Scatter Plots Relationships between two variables can be visualized by graphing data as a scatter plot. Think of the two list as ordered pairs.

More information

Using the Matplotlib Library in Python 3

Using the Matplotlib Library in Python 3 Using the Matplotlib Library in Python 3 Matplotlib is a Python 2D plotting library that produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.

More information

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations

What is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations

More information

A Brief Introduction to MATLAB

A Brief Introduction to MATLAB A Brief Introduction to MATLAB MATLAB (Matrix Laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB was first designed for matrix computations:

More information

6 Using Technology Wisely

6 Using Technology Wisely 6 Using Technology Wisely Concepts: Advantages and Disadvantages of Graphing Calculators How Do Calculators Sketch Graphs? When Do Calculators Produce Incorrect Graphs? The Greatest Integer Function Graphing

More information

ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots

ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots ENGG1811 UNSW, CRICOS Provider No: 00098G1 W11 slide 1 More on plotting Matlab has a lot of plotting features Won t go through them

More information

Starting a New Matlab m.file. Matlab m.files. Matlab m.file Editor/Debugger. The clear all Command. Our Program So Far

Starting a New Matlab m.file. Matlab m.files. Matlab m.file Editor/Debugger. The clear all Command. Our Program So Far Matlab m.files It is not very convenient to do work directly in the Matlab Command Line Window since: It is hard to remember what we typed. It is hard to edit. It all disappears when we close Matlab. Solution:

More information

Graphics and plotting techniques

Graphics and plotting techniques Davies: Computer Vision, 5 th edition, online materials Matlab Tutorial 5 1 Graphics and plotting techniques 1. Introduction The purpose of this tutorial is to outline the basics of graphics and plotting

More information

CDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation

CDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation CDA6530: Performance Models of Computers and Networks Chapter 4: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted

More information

Python: A great programming toolkit

Python: A great programming toolkit Python: A great programming toolkit Asokan Pichai Prabhu Ramachandran Department of Aerospace Engineering IIT Bombay 25, July 2009 Acknowledgements This program is conducted by IIT, Bombay through CDEEP

More information

Visualisation Lab: gnuplot

Visualisation Lab: gnuplot Visualisation Lab: gnuplot Anton Gerdelan February 2, 2012 What is gnuplot? gnuplot is a tool for creating graphs and charts. gnuplot has a terminal. You can enter commands to tell gnuplot how to format

More information

3d plots. John Perry. Fall 2013

3d plots. John Perry. Fall 2013 MAT 305: 3d plots University of Southern Mississippi Fall 2013 Outline 1 2 3 Outline 1 2 3 The point3d() command point3d((x, y, z), options) where (x,y,z) is a 3-tuple (the location in 3 of this point)

More information

Python language: Basics

Python language: Basics Python language: Basics The FOSSEE Group Department of Aerospace Engineering IIT Bombay Mumbai, India FOSSEE Team (FOSSEE IITB) Basic Python 1 / 45 Outline 1 Data types Numbers Booleans Strings 2 Operators

More information

EE 301 Signals & Systems I MATLAB Tutorial with Questions

EE 301 Signals & Systems I MATLAB Tutorial with Questions EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This

More information

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB

More information

1. Register an account on: using your Oxford address

1. Register an account on:   using your Oxford  address 1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation

More information

Introduction to Python and NumPy I

Introduction to Python and NumPy I Introduction to Python and NumPy I This tutorial is continued in part two: Introduction to Python and NumPy II Table of contents Overview Launching Canopy Getting started in Python Getting help Python

More information

Introduction to MATLAB LAB 1

Introduction to MATLAB LAB 1 Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions

More information

); and XSCALE=4 is a probability scale (distance in plot is related to erf 1 (x)).

); and XSCALE=4 is a probability scale (distance in plot is related to erf 1 (x)). Appendix B: plot plot is a general purpose, advanced plotting program. plot can be frustrating to use because it assumes you know what you want to do and actually mean what you say so if you don t know

More information

Computational lab on complex numbers

Computational lab on complex numbers Computational lab on complex numbers SAK, physics 1140 March 15, 2010 1 Objective To learn how to use MATLAB as an advanced calculator and gain familiarity with complex numbers using MATLAB. 2 Introduction

More information

PSY8219 : Week 6. Homework 5 Due Today. Homework 6 Due October 8. Readings for Today Attaway Chapter 6, 10, and 12

PSY8219 : Week 6. Homework 5 Due Today. Homework 6 Due October 8. Readings for Today Attaway Chapter 6, 10, and 12 Homework 5 Due Today PSY8219 : Week 6 Homework 6 Due October 8 Readings for Today Attaway Chapter 6, 10, and 12 Readings for Next Week Attaway Chapter 12 and 13 Turning in Homework Assignments Remember

More information

Complex Dynamic Systems

Complex Dynamic Systems Complex Dynamic Systems Department of Information Engineering and Mathematics University of Siena (Italy) (mocenni at dii.unisi.it) (madeo at dii.unisi.it) (roberto.zingone at unisi.it) Lab Session #1

More information

EOSC 352 MATLAB Review

EOSC 352 MATLAB Review EOSC 352 MATLAB Review To use MATLAB, you can either (1) type commands in the window (i.e., at the command line ) or (2) type in the name of a file you have made, whose name ends in.m and which contains

More information

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing MS6021 Scientific Computing TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing Preliminary Notes on Python (v MatLab + other languages) When you enter Spyder (available on installing Anaconda),

More information

ME 121 MATLAB Lesson 01 Introduction to MATLAB

ME 121 MATLAB Lesson 01 Introduction to MATLAB 1 ME 121 MATLAB Lesson 01 Introduction to MATLAB Learning Objectives Be able run MATLAB in the MCECS computer labs Be able to perform simple interactive calculations Be able to open and view an m-file

More information

3 An Introductory Demonstration Execute the following command to view a quick introduction to Matlab. >> intro (Use your mouse to position windows on

3 An Introductory Demonstration Execute the following command to view a quick introduction to Matlab. >> intro (Use your mouse to position windows on Department of Electrical Engineering EE281 Introduction to MATLAB on the Region IV Computing Facilities 1 What is Matlab? Matlab is a high-performance interactive software package for scientic and enginnering

More information

A Tutorial on Matlab Ch. 3 Programming in Matlab

A Tutorial on Matlab Ch. 3 Programming in Matlab Department of Electrical Engineering University of Arkansas A Tutorial on Matlab Ch. 3 Programming in Matlab Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Plotting M-file Scripts Functions Control Flows Exercises

More information

CDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation

CDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation CDA5530: Performance Models of Computers and Networks Chapter 8: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted

More information

Homework 1 Description CmpE 362 Spring Instructor : Fatih Alagoz Teaching Assistant : Yekta Said Can Due: 3 March, 23:59, sharp

Homework 1 Description CmpE 362 Spring Instructor : Fatih Alagoz Teaching Assistant : Yekta Said Can Due: 3 March, 23:59, sharp Homework 1 Description CmpE 362 Spring 2016 Instructor : Fatih Alagoz Teaching Assistant : Yekta Said Can Due: 3 March, 23:59, sharp Homework 1 This homework is designed to teach you to think in terms

More information

Armstrong Atlantic State University Engineering Studies MATLAB Marina 2D Plotting Primer

Armstrong Atlantic State University Engineering Studies MATLAB Marina 2D Plotting Primer Armstrong Atlantic State University Engineering Studies MATLAB Marina D Plotting Primer Prerequisites The D Plotting Primer assumes knowledge of the MATLAB IDE, MATLAB help, arithmetic operations, built

More information

An Introduction to Numerical Methods

An Introduction to Numerical Methods An Introduction to Numerical Methods Using MATLAB Khyruddin Akbar Ansari, Ph.D., P.E. Bonni Dichone, Ph.D. SDC P U B L I C AT I O N S Better Textbooks. Lower Prices. www.sdcpublications.com Powered by

More information

wxmplot documentation

wxmplot documentation wxmplot documentation Release 0.9.12 Matthew Newville April 02, 2013 CONTENTS 1 Prerequisites 3 2 Downloads 5 3 Development Version 7 4 Installation 9 5 License 11 6 PlotPanel: A wx.panel for Basic 2D

More information

drawing tools and illustration features of PowerPoint

drawing tools and illustration features of PowerPoint drawing tools and illustration features of PowerPoint The$Harvard$Medical$School$is$accredited$by$the Accreditation$Council$for$Continuing$Medical$Education to$provide$continuing$medical$education$for$physicians.$

More information

Grace days can not be used for this assignment

Grace days can not be used for this assignment CS513 Spring 19 Prof. Ron Matlab Assignment #0 Prepared by Narfi Stefansson Due January 30, 2019 Grace days can not be used for this assignment The Matlab assignments are not intended to be complete tutorials,

More information

Lecture 6: Plotting in MATLAB

Lecture 6: Plotting in MATLAB Lecture 6: Plotting in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE21: Computer Applications. See Textbook Chapter 5. A picture is worth a thousand words MATLAB allows

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User

More information

roboturtle Documentation

roboturtle Documentation roboturtle Documentation Release 0.1 Nicholas A. Del Grosso November 28, 2016 Contents 1 Micro-Workshop 1: Introduction to Python with Turtle Graphics 3 1.1 Workshop Description..........................................

More information

STAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006

STAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006 STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics

More information

4. BASIC PLOTTING. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman

4. BASIC PLOTTING. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman 4. BASIC PLOTTING JHU Physics & Astronomy Python Workshop 2016 Lecturer: Mubdi Rahman INTRODUCING MATPLOTLIB! Very powerful plotting package. The Docs: http://matplotlib.org/api/pyplot_api.html GETTING

More information

Signals and Systems Profs. Byron Yu and Pulkit Grover Fall Homework 1

Signals and Systems Profs. Byron Yu and Pulkit Grover Fall Homework 1 18-290 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 2018 Homework 1 This homework is due in class on Thursday, September 6, 9:00am. Instructions Solve all non-matlab problems using only paper

More information

Basic Beginners Introduction to plotting in Python

Basic Beginners Introduction to plotting in Python Basic Beginners Introduction to plotting in Python Sarah Blyth July 23, 2009 1 Introduction Welcome to a very short introduction on getting started with plotting in Python! I would highly recommend that

More information

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial STAT/MATH 395 A - PROBABILITY II UW Winter Quarter 2016 Néhémy Lim Matlab Tutorial 1 Introduction Matlab (standing for matrix laboratory) is a high-level programming language and interactive environment

More information