william r carson - university of cambridge

20
Digital Technology Group 1/20 Computer Laboratory Digital Technology Group Computer Laboratory William R Carson Building on the presentation by Francisco Monteiro Matlab

Upload: others

Post on 10-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Digital Technology Group1/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

William R Carson

Building on the presentation by Francisco Monteiro

Matlab

Digital Technology Group2/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

The product:

MATLAB® - The Language of Technical Computing

The company:

The MathWorks® - Accelerating the pace of engineering and science

Matlab

Digital Technology Group3/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Year Version Notable Features

1978 Classic MATLAB Original Fortran version

1984 MATLAB 1 Rewritten in C

1885 MATLAB 2 30% more commands and functions

1987 MATLAB 3 Colour and high resolution graphics printing

1992 MATLAB 4 Sparse matrixes, animations, debugger, windows support

1997 MATLAB 5 Profiler, object-oriented, multi-D arrays,

2000 MATLAB 6 (R12) Desktop, PDE’s, Java support

2002 MATLAB 6.5 (R13) Performance acceleration, core algebra for Pent4

2004 MATLAB 7.0 (R14) M-file to HTML, LaTex and others

2007 MATLAB 7.4 (R2007a) Performance acceleration, more toolboxes

2007 MATLAB 7.4 (R2007b) C code generation from Embedded MATLABfunctions directly at the MATLAB command line

Matlab

Digital Technology Group4/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

• MATLAB GUIDE by Higham and Higham

• Wikipedia

• http://en.wikipedia.org/wiki/MATLAB

• The MathWorks

• Computing Service

• http://www.cam.ac.uk/cs/courses/coursedesc/full.html#extmatlab

References

Digital Technology Group5/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

1- Automatic Storage Allocation

>> x(3)=0

x = 0 0 0

x(6)=0

x = 0 0 0 0 0 0

Distinctive features

Digital Technology Group6/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

2- Variable Arguments Lists

Variable number of both inputs and outputs. Functions can even vary their behaviour depending on the input parameters

x=[3 4]

norm(x); ans = 5 (Euclidean distance <default>)

norm(x,1); ans = 7 (Manhattan distance)

Distinctive features

Digital Technology Group7/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

2- Variable Arguments Lists

>>m=max(x) m = 4;

>>[m,k]=max(x) m = 4;

k = 2;

>>s = size(x) s = 12

>>[m,n] = size(x) m = 1

n = 2

Distinctive features

Digital Technology Group8/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

2- Variable Arguments Lists

Distinctive features

Digital Technology Group9/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

3- Complex Arrays and Arithmetic

• The fundamental data type: a multidimensional array of complex numbers.

• Fortran, two data types (real/imaginary)

• C, C++, and Java only real

• Pitfalls

• Redefining imaginary numbers

• Max, min, sort for real and complex data

Distinctive features

Digital Technology Group10/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Matrices

- Generation

-Manipulation

Digital Technology Group11/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Matrices

Digital Technology Group12/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Graphics

Digital Technology Group13/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Graphics

Digital Technology Group14/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Writing m-files

Digital Technology Group15/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Debugging m-files

Digital Technology Group16/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Saving graphics

Digital Technology Group17/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Built-in functions

• Help files

• Data analysis

• Equation solving

Digital Technology Group18/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Toolboxes

Digital Technology Group19/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

External C and Fortran

•Called from MATLAB using MEX

•Requires a gateway routine

•Use as if regular function

Digital Technology Group20/20

Computer LaboratoryDigital Technology Group

Computer Laboratory

Limitations

- Licenced product

- y = f(x) ambiguity

- Arrays initial index is 1

- No references