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

Similar documents
(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB

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

HiQ Analysis, Visualization, and Report Generation

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS

Maths for Signals and Systems Linear Algebra in Engineering. Some problems by Gilbert Strang

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.

Fundamentals of MATLAB Usage

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

MATLAB. Advanced Mathematics and Mechanics Applications Using. Third Edition. David Halpern University of Alabama CHAPMAN & HALL/CRC

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

Introduction to Matlab

Matlab Tutorial, CDS

Introduction to MATLAB Practical 1

2.0 MATLAB Fundamentals

CE890 / ENE801 Lecture 1 Introduction to MATLAB

GRAPHICS AND VISUALISATION WITH MATLAB

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

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

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

Chapter 2. MathScript

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

Justify all your answers and write down all important steps. Unsupported answers will be disregarded.

Introduction to MATLAB

Chapter 11. Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB.

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

MATLAB Guide to Fibonacci Numbers

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

CS 450 Numerical Analysis. Chapter 7: Interpolation

Points Lines Connected points X-Y Scatter. X-Y Matrix Star Plot Histogram Box Plot. Bar Group Bar Stacked H-Bar Grouped H-Bar Stacked

2.7 Numerical Linear Algebra Software

Math 2B Linear Algebra Test 2 S13 Name Write all responses on separate paper. Show your work for credit.

Matlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:

Honors Precalculus: Solving equations and inequalities graphically and algebraically. Page 1

Scientific Computing: Interpolation

Data-Driven Modeling. Scientific Computation J. NATHAN KUTZ OXPORD. Methods for Complex Systems & Big Data

PROGRAMMING AND ENGINEERING COMPUTING WITH MATLAB Huei-Huang Lee SDC. Better Textbooks. Lower Prices.

Optimised corrections for finite-difference modelling in two dimensions

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

Summer 2009 REU: Introduction to Matlab

CS 6210 Fall 2016 Bei Wang. Review Lecture What have we learnt in Scientific Computing?

EXERCISES Introduction to MATLAB: Graphics

AMS526: Numerical Analysis I (Numerical Linear Algebra)

LEARNING TO PROGRAM WITH MATLAB. Building GUI Tools. Wiley. University of Notre Dame. Craig S. Lent Department of Electrical Engineering

Semester Final Report

MATLAB SUMMARY FOR MATH2070/2970

MATLAB Tutorial. Primary Author: Shoumik Chatterjee Secondary Author: Dr. Chuan Li

Huei-Huang Lee. Programming with MATLAB2016 SDC ACCESS CODE. Better Textbooks. Lower Prices. UNIQUE CODE INSIDE

Introduction to Python Practical 1

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment

Revision Problems for Examination 2 in Algebra 1

MATH 5520 Basics of MATLAB

Computer Graphics Hands-on

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

Part VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10,

MATH 3511 Basics of MATLAB

Dr. Iyad Jafar. Adapted from the publisher slides

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

MATH 2221A Mathematics Laboratory II

Part V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017

Sung-Eui Yoon ( 윤성의 )

MATLAB 7. The Language of Technical Computing KEY FEATURES

The Singular Value Decomposition: Let A be any m n matrix. orthogonal matrices U, V and a diagonal matrix Σ such that A = UΣV T.

AMS 27L LAB #2 Winter 2009

A quick Matlab tutorial

Numerical Methods for PDEs : Video 11: 1D FiniteFebruary Difference 15, Mappings Theory / 15

A Brief Introduction to MATLAB

Introduction to Matlab

Eric W. Hansen. The basic data type is a matrix This is the basic paradigm for computation with MATLAB, and the key to its power. Here s an example:

Contents. I The Basic Framework for Stationary Problems 1

Introduction to MATLAB

Recognition, SVD, and PCA

Identity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans =

calibrated coordinates Linear transformation pixel coordinates

Fourier transforms and convolution

Introduction to Matlab

1 Introduction to Matlab

Math Scientific Computing - Matlab Intro and Exercises: Spring 2003

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

Plotting using Matlab. Vytautas Astromskas

Parallel Implementations of Gaussian Elimination

Introduction to MATLAB

CALCULATING RANKS, NULL SPACES AND PSEUDOINVERSE SOLUTIONS FOR SPARSE MATRICES USING SPQR

Realization of Hardware Architectures for Householder Transformation based QR Decomposition using Xilinx System Generator Block Sets

GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III Pacing Guide FIRST NINE WEEKS

Introduction to Matlab

Chapter 8 Complex Numbers & 3-D Plots

Curve and Surface Fitting with Splines. PAUL DIERCKX Professor, Computer Science Department, Katholieke Universiteit Leuven, Belgium

MAT 275 Laboratory 1 Introduction to MATLAB

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

Introduction to MATLAB for CSE390

MTH309 Linear Algebra: Maple Guide

CS 475 / CS 675 Computer Graphics. Lecture 16 : Interpolation for Animation

Polymath 6. Overview

1. Register an account on: using your Oxford address

The MAPLE BOOK FRANK GARVAN CHAPMAN & HALL/CRC. A CRC Press Company Boca Raton London New York Washington, D.C.

COMP 558 lecture 19 Nov. 17, 2010

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Chapter 18. Geometric Operations

Transcription:

Applied Linear Algebra in Geoscience Using MATLAB

Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional Plots Programming in MATLAB User-Defined Functions and Function Files Polynomials, Curve Fitting, and Interpolation Applications in Numerical Analysis Three-Dimensional Plots Symbolic Math Matrices Linear equations Determinants Eigenvalues and eigenvectors Orthogonal vectors and matrices Vector and matrix norms Gaussian elimination and the LU dec. Linear system applications Gram-Schmidt decomposition The singular value decomposition Least-squares problems Linear Independence Basis of a Subspace The Rank of a Matrix Implementing the QR factorization The algebraic eigenvalue problem

Linear system applications four additional applications that make use of linear algebra. Fourier series, Finite Difference schemes for solving PDE. Least Squares Cubic Spline interpolation. FOURIER SERIES To this point, we have dealt with finite-dimensional vector spaces, but there are many applications for vector spaces with infinitely many dimensions. A particularly important example is Fourier series. we introduced the inner product of vectors also presented the L 2

Linear system applications Consider the infinite sequence of trigonometric functions A straightforward computation shows that this is an orthonormal sequence over the interval π x π.

Linear system applications We now consider this infinite sequence to be an orthonormal basis for what we term a function space, a set of linear combinations of the basis functions. Note: Not all functions belong to this function space (e.g. ai = 1, bi = 0) For f to belong to the function space, we require that f 2 be finite. Since is an orthonormal sequence Thus, our function is in this function space if the above series converges, and we call it the Fourier series for f. The a i, b i are called the Fourier coefficients for f.

Linear system applications How do we compute the Fourier coefficients? ----- > The basis is orthonormal < ------ Multiply both sides by cos kx for any k 1 and integrate from π to π. and so In a similar fashion It only remains to compute a 0 :

Linear system applications Summary The Fourier coefficients for the function f, π x π, are Now, if we have a periodic function f, is there a Fourier series that converges to f? Example: The Square Wave The square wave is periodic and, has period 2π, and is +1 in one-half the period and 1 in the other half. The Fourier series for the square wave is not difficult to compute. All the cosine terms in its Fourier series are 0, since the function is odd (f ( x) = f (x)). The series is

Linear system applications function psum = sqrwavepartialsums(t,n) m = length(t); psum = zeros(m,1); function psum = sqrwavepartialsums(t,n) sum = 0.0; for i = 1:n j = 2*i-1; sum = sum + sin(j.*t)./j; end psum = (4/pi)*sum; for k = 1:m x = t(k); sum = 0.0; for i = 1:n j = 2*i-1; sum = sum + sin(j*x)/j; end psum(k) = (4/pi)*sum; end

Advanced Plotting 3D Surface and Contour Plots To graph a function of two variables we need to first evaluate that function over a grid of points, not just a line as in the 2D case. Some functions, while still vectorized, will only operate on vectors and not matrices. for example the mvnpdf() function.we can still plot such functions in 3D with a few small changes After obtaining X and Y from meshgrid(), save X's size, evaluate f by passing in X and Y as column vectors, (using the : operator), and then reshape the output Z back to the original size and continue

Advanced Plotting There are several 3d plot types available. Here we use surf(), which plots the surface of the function, contourf(), which plots the contour lines of a function and fills the area between them with color, and mesh(), which is similar to surf(), displaying a wire mesh rather than a solid surface. The colors used in each are specified by the current colormap and can be changed by using the colormap() command. Type doc colormap for a list of options. There are several other 3d plotting functions: plot3() for instance is the 3d generalization of plot().

Advanced Plotting Note, the command view([90,90]) can be very useful to rotate a plot by 90 degrees, effectively reversing the locations of the x and y axes. Virtually everything about customizing 2D plots applies equally to 3D plots. We can add a title, a legend, labels using xlabel(), ylabel(), and zlabel(), change the range of the axes, the font size, etc.

Advanced Plotting Below we display a 3d bar plot of the same underlying data. We take advantage of the mat2cell() command to partition the Z data into 21x21 6-by-6 blocks, each block stored within a cell. We then use the cellfun() function to replace each block with its mean. We can use this same technique to apply any function to arbitrary sized blocks of a matrix. Note that when the size of the data within cells is different, 'UniformOutput' must be set to false.

Advanced Plotting 3D plotting in Matlab requires a uniform grid of points but the data we obtain from experiments or measurements may not satisfy this constraint. In such cases, we can use the griddata() function to interpolate along a uniform grid of points for us.

Advanced Plotting Rotating Figures and Creating Movies Figures can be rotated or moved with the mouse by first clicking on the appropriate shortcut button on a figure window toolbar. However, we can also automate and animate the rotation by using the camorbit() command. We can also create a movie by capturing frames using getframe() command and playing them with the movie() function. Alternatively we can create an avi file with the avifile(), andaddframe() functions. Read their help entries for more information and examples. There are many other functions that can be used to adjust the camera angle and motion such ascamdolly(), campan(), camzoom(), and camroll().

Advanced Plotting Annotations and the Plot Editor Matlab provides an interactive graphical interface for modifying and inspecting existing figures. This mode can be entered by selecting 'view->figure Palette' or by selecting the appropriate shortcut button on the figure toolbar. Here we can add annotations such as text, arrows, and shapes as you would in a program like powerpoint. We can also inspect and change attributes as an alternative to using set() and get(). Annotations are placed relative to the figure window, not the axes. The location is, by default, specified by normalized coordinates between 0 and 1 so that [0.8 0.4] is the point 80% of the width from the left and 40% of the height from the bottom. In the case of a line or an arrow, we specify two x-y pairs, denoting the start and end points. In the case of a text box we specify four numbers, the x and y coordinates followed by the width and height of the box. Type doc annotation for more information. These commands were generated automatically after adding the annotations in the plot editor.

Advanced Plotting