Introduction to MATLAB

Similar documents
Introduction to MATLAB

EXERCISES Introduction to MATLAB: Graphics

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

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

Introduction to MATLAB

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

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

Dr. Iyad Jafar. Adapted from the publisher slides

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

DATA PLOTTING WITH MATLAB

SGN Introduction to Matlab

Mechanical Engineering Department Second Year (2015)

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

FF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini

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

Basic Graphs. Dmitry Adamskiy 16 November 2011

Name: Math Analytic Geometry and Calculus III - Spring Matlab Project - due on Wednesday, March 30

The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB

Introductory Scientific Computing with Python

1 >> Lecture 4 2 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 243

Lecture 6: Plotting in MATLAB

Introduction to Matlab

MATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting

Introduction to MATLAB Practical 1

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

Getting Started with MATLAB

LabVIEW MathScript Quick Reference

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

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

INTRODUCTION TO MATLAB

MATH 2221A Mathematics Laboratory II

CSE 123. Plots in MATLAB

PROGRAMMING WITH MATLAB WEEK 6

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

Dr Richard Greenaway

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

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

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

Modeling and Simulating Social Systems with MATLAB

Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures

NatSciLab - Numerical Software Introduction to MATLAB

Beyond the Mouse A Short Course on Programming

Contents. Implementing the QR factorization The algebraic eigenvalue problem. Applied Linear Algebra in Geoscience Using MATLAB

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

Graphics Example a final product:

GRAPHICS AND VISUALISATION WITH MATLAB

Introduction to MATLAB: Graphics

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

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

Graphics and plotting techniques

Lecturer: Keyvan Dehmamy

This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in

Getting Started with Matlab

Math 7 Elementary Linear Algebra PLOTS and ROTATIONS

CCNY. BME 2200: BME Biostatistics and Research Methods. Lecture 4: Graphing data with MATLAB

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

Introduction to graphics

Plotting using Matlab. Vytautas Astromskas

Lab 5: Matlab Tutorial Due Sunday, May 8 at midnight

Lab 6: Graphical Methods

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

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

COMS 3101 Programming Languages: MATLAB. Lecture 3

DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

Introduction to MATLAB

Introduction to Simulink

MATLAB Vocabulary. Gerald Recktenwald. Version 0.965, 25 February 2017

Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization

PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING "CIPM 2017" Matlab Fun - 2

Table of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7

The College of Staten Island

Introduction to MATLAB

INTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore

A Brief Introduction to MATLAB

fplot Syntax Description Examples Plot Symbolic Expression Plot symbolic expression or function fplot(f) fplot(f,[xmin xmax])

Introduction to MATLAB LAB 1

Introduction to Matlab

Lecture 3 for Math 398 Section 952: Graphics in Matlab

Introduction to Matlab

Introduction to Python Practical 1

Plotting - Practice session

What is Matlab? A software environment for interactive numerical computations

MATLAB Tutorial CSHA Suzhou Course 2011

Introduction to Simulink

Graphics in MATLAB. Responsible teacher: Anatoliy Malyarenko. November 10, Abstract. Basic Plotting Commands

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting

Introduction to Matlab. WIAA Technical Workshop #2 10/20/2015

2. Plotting in MATLAB

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

Matlab Tutorial: Basics

Computer Programming in MATLAB

MATLAB for Image Processing. April 2018 Rod Dockter

Can be put into the matrix form of Ax=b in this way:

Matlab Introduction. Scalar Variables and Arithmetic Operators

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

Introduction to Matlab

Introduction to Programming in MATLAB

Transcription:

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, ODEs Graphics and Visualization Basic Programming Programming Practice Statistics and Data Analysis

Resources Class materials http://web.mit.edu/acmath/matlab/iap2007 Previous session: InterfaceBasics <.zip,.tar> This session: Graphics <.zip,.tar> Mathematical Tools at MIT web site http://web.mit.edu/ist/topics/math

MATLAB Help Browser MATLAB + Graphics + MATLAB Plotting Tools + Annotating Graphs + Basic Plotting Commands + Figure Properties + Axes Properties + 3D Visualization + Creating 3D Graphs

MATLAB Graphics 2D and 3D Plotting Figure Property Editing Animation

Figure Editor To open a new figure window: >> figure To plot in the current figure window: >> plot (X, Y, ro ) >> surf (x, y, z) >> contour (x, y, z, N) Plotting commands create a figure window if none is open.

Creating 2D Graphs 2D linear plots: plot >> plot (t, z, r- ) >> plot (X, Y, Color, [1 0 1], Marker, o, LineStyle, none ) Graph annotation >> legend ( z = f(t) ) >> title ( Position vs. Time ) >> xlabel ( Time ) >> ylabel ( Position )

Multiple Plots Multiple datasets on a plot >> p1 = plot(xcurve, ycurve) >> hold on >> p2 = plot(xpoints, Ypoints, ro ) >> hold off Subplots on a figure >> s1 = subplot(1, 2, 1) >> p1 = plot(time, velocity) >> s2 = subplot(1, 2, 2) >> p2 = plot(time, acceleration)

Graphics Exercises Exercise One: subplots.m 2D plotting Subplots Property Editor Follow instructions in m-file

Other 2D Graphs Contour plots >> contour (x, y, z, N) Note: x, y, and z are matrices, not vectors. Polar coordinates >> polar(theta, rho) e.g. >> t = [0 : 0.01 : 2*pi] >> polar (sin(t), cos(t))

Creating 3D Graphs Linear plots >> plot3 (X, Y, Z, ro ) Note: X, Y, and Z are vectors. Surface and mesh plots >> surf(x, y, z) >> mesh (x, y, z) Note: x, y, and z are matrices, not vectors. 3D contour plots >> contour3(x, y, z, N)

3D Graph Example Domain Generation >> [x, y] = meshgrid([-3 : 0.25 : 3], -3 : 0.25 :3]); >> z = x.* exp(-(x.^2 + y.^2)); Plot generation >> s1 = surf(x, y, z)

Figure and Axes Handles Get current figure and axes: >> p1 = plot3(x, Y, ro ) >> fig1 = gcf >> ax1 = gca % Alternatively: >> ax1 = get(fig1, CurrentAxes ) Set figure and axes properties: >> set(fig1, Color, [0.9 0.8 0.7]) >> axes(ax1) >> axis([xmin Xmax Ymin Ymax])

Property Editor Start Plot Edit mode >> plotedit on or click on in the Figure window. Open Property Editor View->Property Editor Select element to edit e.g. Property Editor - Axes Edit element-specific properties

Saving Figures From the Figure window File->Save As MATLAB format: figurename.fig Other formats: TIFF, JPEG, etc. From the command line >> saveas(fig1, figurename.tif )

Graphics Exercises Exercise Two: surfacepoints.m 3D plotting Multiple datasets Figure and graphics handles Graphics customizations Graphics export Follow instructions in m-file

Animation Create animated plot of y(x) set(gcf, 'DoubleBuffer', 'on') for i = 1 : length(x) p1 = plot(x(i), y(i), 'bo') hold on % Enforce the same axes set(gca, 'XLim', [xmin xmax], 'YLim', [ymin ymax]) drawnow end Export animation: getframe, movie2avi

Graphics Exercises Animation Example: helix.m Exercise Three: cubic.m Animations Follow instructions in m-file