Introduction to Matlab:

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

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.
Programming Environment S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Cells and Structures.
Chapter 11 Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB.
Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Interpolation.
Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration.
Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Optimization Toolbox.
KRZYSZTOF PIETRUSZKA, ph.D. www: www:
Fall 2006AE6382 Design Computing1 Three Dimensional Plotting Learning Objectives –Understand the anatomy of a 3D plot –Basics of constructing plots in.
Programming Environment S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Control Flow.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
S. Mandayam/ EEMAG-1/ECE Dept./Rowan University Engineering Electromagnetics Fall 2004 Shreekanth Mandayam ECE Department Rowan University.
An Introduction to MATLAB Magali Billen U C Davis, Geology Department.
1 Introduction to MatLab MatLab stands for Matrix Laboratory. As the name suggests most of the programming operations have as input or output a matrix.
Outline 1- Quick Introduction to MATLAB 2- PDE Toolbox 3- BVP
S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Matlab Basics Introduction to Matlab: Matrix Operations.
Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Polynomial Manipulations.
EPSII 59:006 Spring Outline Managing Your Session File Usage  Saving Workspace  Loading Data Files  Creating M-files More on Matrices Review.
Basis of Mathematical Modeling LECTURE 1 Computation and visualization in MATLAB Dr. N.K. Sakhnenko, PhD, Professor Associate.
 1999 BG Mobasseri1 8/29/2015 MATLAB GRAPHICS - PART II ADVANCED PLOTTING June 4, ‘99.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Matlab Training Sessions 6,7: Plotting. Course Outline Weeks: 1.Introduction to Matlab and its Interface (Jan ) 2.Fundamentals (Operators) 3.Fundamentals.
Plotting – 3-Dimensional. 3D Plots versus 2D Plots 3-dimensional plots, in contrast to 2-dimensional ones, has a third axis (often called the z-axis).
Computational Biology, Part E Basic Principles of Computer Graphics Robert F. Murphy Copyright  1996, 1999, 2000, All rights reserved.
Chapter 10: Graphics MATLAB for Scientist and Engineers Using Symbolic Toolbox.
PDE Toolbox The Partial Differential Equation Toolbox is a Matlab based collection of tools for solving Partial Differential Equations (PDEs) on a two-dimensional.
MA/CS 3751 Fall 2002 Lecture 24. MA/CS 3752 ginput ginput is a Matlab function which takes one argument input: number of points to select in the image.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5B Model.
S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: User Input / Output Programming Environment.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 4 : Polynomial Edward Cheung Room W311g 2008.
Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5B Model.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Introduction to MATLAB Session 5 Simopekka Vänskä, THL 2010.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5 Advanced.
2D Routines in 3D. Outline Announcements –HW II--due Friday. 5PM HW1 & Cookie Grids & Meshes Representing f(x,y) Lines & Surfaces in 3D Survey.
Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic.
Mohiuddin Ahmad SUNG-BONG JANG Interpolation II (8.4 SPLINE INTERPOLATION) (8.5 MATLAB’s INTERPOLATION Functions)
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
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 Complex Numbers & 3D Plots – Part 2 Friday 07 Nov 2014 EGR 115 Introduction to Computing for Engineers.
Intro to Matlab Rogelio Long September 3, How to access MyDesktop Log in with your utep id and password.
More Matlab Graphics and GUI Graphics subplots some useful commands 3D graphics GUI GUI controls The callback property Other essential properties.
An Introduction to Programming in Matlab Emily Blumenthal
Photonic Systems Laboratory School of EE, Seoul National University Photonic Systems Lab School of EECS, S.N.U. Introduction to Electromagnetism.
EEE 242 Computer Tools for Electrical Engineering
Image Warping 2D Geometric Transformations
Lecture 17 More Plotting Chapter 12 Matrices. Outline from Chapter D Plotting 11.4 Surface Plots 11.5 Interacting with Plotted Data.
Session III Plotting in MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU MATLAB Tutorials.
CS112 Scientific Computation Department of Computer Science Wellesley College Kodak moments 3-D Visualization and Color.
CS112 Scientific Computation Department of Computer Science Wellesley College Kodak moments 3-D Visualization and Color.
Advanced Plotting Techniques Chapter 11 Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB.
Plots and Graphics.
Computer Application in Engineering Design
ENEE222 Elements of Discrete Signal Analysis Lab 11 1.
3D-Graphs A 3D surface is defined as: z = f(x, y)
Lecture 25.
Ch3 Graphics Overview of Plotting Editing Plots
Two-Dimensional Plots
2D Routines in 3D.
MatLab – Palm Chapter 5 2-D & 3-D Plots
CSCI N317 Computation for Scientific Applications Unit 1 – 5 MATLAB
Yang-Ming University, Taipei, Taiwan
Symbolic matlab toolbox
Visualization CSE 694L Roger Crawfis The Ohio State University.
An Introduction to MATLAB
Introduction to Matlab
Introduction to Matlab: Element by Element Operations
Presentation transcript:

Introduction to Matlab: Matlab Graphics 3D Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn

3D Graphics Topics Creating Mesh and Surface Plots Viewing a Pseudocolor Matrix Creating Contour Plots Adding a Color-Bar Interpolating 3D Data

Mesh and Surface Plots Useful for displaying functions of 2 variables or to visualize large matrices Given a function f(x,y) of two variables: Assume that: » x=[-1:0.2:1]; y=[-1:0.2:1]; We can plot the function z as a mesh or surface plot

4/15/2017 Calculating xx Height = Length of y Row = Vector x

Generating xx in Matlab » xx=ones(length(x),1)*x xx = -1.0000 -0.5000 0 0.5000 1.0000

Calculating yy Length = Length of y Column = y Transpose

Generating yy in Matlab » yy=y'*ones(1,length(y)) yy = -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -0.5000 -0.5000 -0.5000 -0.5000 -0.5000 0 0 0 0 0 0.5000 0.5000 0.5000 0.5000 0.5000 1.0000 1.0000 1.0000 1.0000 1.0000

Find xx & yy Using Meshgrid » [xx,yy] = meshgrid(x,y) xx = -1.0000 -0.5000 0 0.5000 1.0000 yy = -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -0.5000 -0.5000 -0.5000 -0.5000 -0.5000 0 0 0 0 0 0.5000 0.5000 0.5000 0.5000 0.5000 1.0000 1.0000 1.0000 1.0000 1.0000

Find z Find z using element by element computations » z=xx.*exp(-xx.^2-yy.^2) z = -0.1353 -0.1433 0 0.1433 0.1353 -0.2865 -0.3033 0 0.3033 0.2865 -0.3679 -0.3894 0 0.3894 0.3679

Mesh Plot z » mesh(x,y,z) Finer increments of x and y will smooth the surface

Mesh for a Larger x & y Create a new mesh plot complete with labels » [xx,yy]=meshgrid(x,y); » z=xx.*exp(-xx.^2-yy.^2); » mesh(x,y,z) » title('Larger Mesh'); » xlabel('X Data'); » ylabel('Y Data'); » zlabel('z=xx.*exp(-xx.^2-yy.^2)');

Surface Plot of z » surf(x,y,z) Plots the colored parametric surface where color is proportional to surface height

Pcolor pseudocolor or "checkerboard" plot of matrix » pcolor(x,y,z) pseudocolor or "checkerboard" plot of matrix The values of the elements specify the color in each cell of the plot

Contour Plots contour plot of matrix where z contains heights above a plane Number of Contour Lines » contour(x,y,z,16); » title('Contour');

Displaying Contour Heights To write the values identifying the heights: » cs=contour(x,y,z,16); » clabel(cs); » title('Contour Heights');

Meshc Contour Plots meshc is same as mesh except that a contour plot is drawn beneath the mesh » meshc(x,y,z) Only works for surfaces defined on a rectangular grid

Adding a Colorbar colorbar adds a vertical line (color scale) to show the contour plots

3D Interpolation Rough or scattered data can be interpolated using mesh The original data is plotted as a mesh by: » x=[-3:3]; y=[1:5]; » [xx, yy]=meshgrid(x,y); » z= xx + yy; » mesh(x,y,z); » title('Original Mesh Grid'); » xlabel('X Data'); ylabel('y Data'); » zlabel('z = xx + yy');

Mesh of Rough Data Original Course Surface where: x = [-3:3] y = [1:5] z = xx+yy

Interpolation of Data The original mesh from the data is can be improved by creating interpolated values using griddata: » xi=[-3:0.5:4]; % Interpolated x axis » yi=[ 0:0.2:5]; % Interpolated y axis » [xxi,yyi]=meshgrid(xi,yi); » % zi = interpolated values » zi=griddata(xx,yy,z,xxi,yyi); » mesh(xxi,yyi,zi); % Better surface » title('Interpolated Mesh Grid'); » xlabel('X Data'); ylabel('y Data'); » zlabel('z = xx + yy');

3D Interpolation Plot Interpolated Smooth Surface where: xi = [-3:0.5:4] yi = [ 0:0.2:5]