Sei sulla pagina 1di 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/258858908

Matlab Tutorials in Surveying Mathematics, Tutorials for 2nd year students

Book · January 2011

CITATIONS READS

0 759

2 authors:

Ahmed Abdalla Paul H Denys


Leibniz Universität Hannover University of Otago
45 PUBLICATIONS   229 CITATIONS    51 PUBLICATIONS   1,093 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Conference Paper View project

New Zealand Plate Tectonics View project

All content following this page was uploaded by Ahmed Abdalla on 08 January 2016.

The user has requested enhancement of the downloaded file.


MATLAB Tutorial

SURV202
Survey Mathematics

Orginal author: Ahmed Abdalla

Revised by: Paul Denys

School of Surveying

Otago University

Dunedin

July 2012
Contents

Contents ii

List of Tables v

List of Figures vi

Preliminaries 1

1 Calculations and Graphs 3


1.1 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 String variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.1 Assigning numerical values for Variables . . . . . . . . . . . . . . . . . . . 4

1.2.2 Variable names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Matrices and Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3.1 Generating Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3.2 Generating Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.3.3 Special Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.4 Matrices and Vectors operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.5 Matrix Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.6 Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.7 Two-dimensional plotting in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . 11

1.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2 Reading and Writing Files 15


2.1 Reading ascii les to MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.1.1 Reading les with load . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.1.2 Reading les with dlmread . . . . . . . . . . . . . . . . . . . . . . . . . 16

School of Surveying, University of Otago Version 12.02 ( July 2012 )


CONTENTS iii

2.1.3 Reading strings data with readtext . . . . . . . . . . . . . . . . . . . . 16

2.1.4 Performing basic calculations on loaded data . . . . . . . . . . . . . . . . 17

2.2 Saving output data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.2.1 Saving les with `fid' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.2.2 Saving les with `dlmwrite' . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.3 Time and date conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.4 Advanced plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.1 Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.2 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.3 Line and Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.4 Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.4.5 Multiplots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Programming with MATLAB 25


3.1 Conditions and Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.1.1 The `If ... end' statement . . . . . . . . . . . . . . . . . . . . . . . . 26

3.1.2 The `while ... end' statements . . . . . . . . . . . . . . . . . . . . . . 27

3.1.3 The `for ... end' statement . . . . . . . . . . . . . . . . . . . . . . . . 27

3.2 M-le Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.3 M-le Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4 Surface, Contour and Vector Field Plots 31


4.1 Contour and Surface plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.2 Contour Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.2.1 Format Geoid Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.2.2 Function contour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.3 Surface Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4.3.1 Function mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4.3.2 Function surf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Version 12.02 ( July 2012 ) School of Surveying, University of Otago


iv CONTENTS

5 Levelling Networks 37
5.1 Observations of equal precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.2 Observation precision proportional to distance . . . . . . . . . . . . . . . . . . . . 41

5.3 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6 Resection and Intersection Calculations 47


6.1 Resection by Distance Observation . . . . . . . . . . . . . . . . . . . . . . . . . . 47

6.2 Resection By Unoriented Direction . . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.3 Intersection by Bearing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

6.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

7 Geoid-Ellipsoid Surface Calculations 58


7.1 Geoid-Ellipsoid model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

7.2 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

8 Horizontal Transformation Calculations 62


8.1 Conformal Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.2 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Suggested References 67

School of Surveying, University of Otago Version 12.02 ( July 2012 )


List of Tables

1.1 MATLAB Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Matrix operation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.4 Arthimetic operations for matrices and vectors . . . . . . . . . . . . . . . . . . . 10

1.5 Matrix functions in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.6 Mathematical functions in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.1 Levelling observation data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.2 Levelling observation data: precision proportional to distance . . . . . . . . . . . 42

6.1 Distance resection: coordinates and distance observations to x station P . . . . 47

6.2 Direction resection: coordinates and distance observations to x station P . . . . 51

6.3 Bearing Intersection: coordinates and distance observations to x station P . . . 54

7.1 Orthometric and Geodetic Heights, North Dunedin . . . . . . . . . . . . . . . . . 58

8.1 Horizontal transformation coordinate data . . . . . . . . . . . . . . . . . . . . . . 62

Version 12.02 ( July 2012 ) School of Surveying, University of Otago


List of Figures

1.7.1 Sine function plot with range [−π : 0.1 : π] . . . . . . . . . . . . . . . . . . . . . 12

1.7.2 Cosine function plot with range [−π : 0.1 : π] . . . . . . . . . . . . . . . . . . . . 13

1.7.3 Combined trigonometric functions plot tan(sin(x)) − sin(tan(x)) . . . . . . . . . 13

2.4.1 A solid line plot with circles as markers . . . . . . . . . . . . . . . . . . . . . . . 21

2.4.2 Fancy informative plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.4.3 Multiplots gure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.2.1 MATLAB Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.3.1 Structure of MATLAB Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.2.1 Figure tool bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2.2 Default contour map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2.3 Contour map with labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2.4 Contour map with a colour scale . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.3.1 Three-dimensional plot using the `mesh' function . . . . . . . . . . . . . . . . . . 36

4.3.2 Three-dimensional plot using the `meshz' function . . . . . . . . . . . . . . . . . 36

4.3.3 Three-dimensional plot using the `surf' function . . . . . . . . . . . . . . . . . . 36

4.3.4 Three-dimensional plot using the `surfl' function . . . . . . . . . . . . . . . . . 36

School of Surveying, University of Otago Version 12.02 ( July 2012 )

View publication stats

Potrebbero piacerti anche