1. Technical computing with Matlab - University of Bath

162 downloads 16 Views 2MB Size Report
Nov 19, 2010 ... Data Import. Datafeed toolbox. Web interface xml file. Database toolbox. Web interface. Proprietary file xml file. Spreadsheet Link EX. Text file.
Technical Computing with MATLAB

University Of Bath Seminar 19th November 2010 Adrienne James (Application Engineering)

1

Agenda    

Introduction to MATLAB Importing, visualising and analysing data from multiple p sources Publishing results to reports Tools for efficient writing writing, maintaining and sharing of MATLAB routines

2

Data Analysis Tasks Access

Explore & Discover

Share

Automate 3

Computational Finance Workflow Access

Research and Quantify

Files

Share Reporting

Data Analysis & Visualization

Databases

Datafeeds

Financial Modeling

Application Development

Applications

Production

Automate 4

Data Import

Datafeed toolbox

xml file

Web interface

Database toolbox

Proprietary file

Web interface

Text file

Text file

Spreadsheet Link EX

5

Accessing Data from MATLAB Access 

Explore & Discover

Share

Files – Excel, text, or binary – Multimedia, Multimedia scientific – Web, XML



Applications and languages – C/C++, Java, FORTRAN – COM, .NET, shared libraries – Databases



Measurement hardware – Data acquisition q hardware for signals or images – Stand-alone instruments and devices

6

Data Analysis and Visualization in MATLAB Access 

Explore & Discover

Share

Data Analysis – Manipulate, preprocess, and manage g data – Fast, accurate analysis with pre-built math, finance & engineering functions



Visualization – Built in graphics functions for engineering and science (2D, 3D, VolViz) – Interactive tools to annotate and customize graphics 7

Sharing Results from MATLAB Access 

Explore and Discover

Share

Automatically generate structured reports – Published MATLAB files – MATLAB® Report Generator



Feed your results into downstream design tools



Deploy applications to other environments

8

9

Data Analysis with MATLAB Toolboxes

Adrienne James

10

Agenda    

Signal processing (spectral analysis, filtering) Working with images, visualisation and analysis Accelerating data analysis with parallel computing Statistics and Optimisation

11

Demo: Analysing live data    



Processing live data Analysing Spectra Developing Graphical User Interfaces (GUIs) Deploying standalone applications Find it on MATLAB Central! http://www.mathworks.in/matlabcentral/fileexchange/2904 12

B i i external Bringing t l Data D t into i t MATLAB MATLAB can read & write any file – High-level support for common formats – Functions to read custom formats

Some toolboxes provide additional accessibility – – – –

Data Acquisition Toolbox Image Acquisition Toolbox I t Instrument t Control C t l Toolbox T lb Database Toolbox

13

Signal Processing with MATLAB Si Signal l Processing P i Toolbox: T lb – Filt Filter design, d i analysis l i and d implementation – Transforms – Statistical signal processing – – – – –

Spectral analysis Waveform generation Data windowing Linear prediction A d more… And 14

Introduction To MathWorks Deployment Products

MATLAB Compiler™

MATLAB Builder™ EX

.exe

.dll/.lib

Excel Add-in

MATLAB Builder™ JA

Java

MATLAB Builder™ NE

www

COM

.NET

15

Introduction to MATLAB Compiler 



 

Automatically packages your MATLAB programs as standalone applications and software components S Supports t full f ll MATLAB language l and mostt toolboxes t lb Allows royalty-free deployment Provides shared infrastructure with MATLAB: – Speed of compiled application equivalent to speed in MATLAB

16

Application Deployment Workflow End-User EndDesktop or Web Server

MATLAB Desktop

.EXE

.EXE

17

High-Throughput Screening 





Typical goal – To observe the reaction of some biological entity of interest (e (e.g. g a protein protein, some cells, or an embryo) to exposure to multiple treatment conditions (e.g. times, drug compounds) Challenges g – Complex data to analyse (e.g. each measurement may require image processing, feature extraction, statistics) – Very large amounts of data (e.g. up to 100000 measurements, each a 100KB image file) – Very fast analysis required (e.g. up to 100000 measurements analysed per day) Solution – Implement and automate complex analyses using MATLAB and Toolboxes – Reduce time of analysis using the Parallel Computing Toolbox

18

Data analysis (Image Processing Toolbox, Curve Fitting Toolbox, Parallel Computing Toolbox)

  

Enhancing, registering and segmenting images, and measuring image features Creating a script to batch process multiple images C Converting ti a b batch t h process tto run iin parallel ll l tto reduce computational time 19

What Can You Do with Image Processing Toolbox™? • Isolate regions of interest in an image to process. • Measure the properties of objects located in an image. • Preprocess p images g by y enhancing g image characteristics, and reducing the effects of noise and motion. • Design and implement 2-D 2 D spatial and frequency filters. • Extract image features using different methodologies. methodologies • Identify image objects by using image registration.

20

Parallel Computing Toolbox p g Server MATLAB Distributed Computing 

Parallel Computing Toolbox: – Run up to 8 MATLAB processes in parallel on a single machine – Share data between processes – Run tasks in parallel across processes



MDCS – MATLAB engine on each node of a cluster – Ideal for large scale batch runs or time intensive calculations i.e. Monte Carlo simulations 21

Model-Ba ased Calibration Toolbox

Bioinform matics Toolbox

Statistics Optimiza ation

Commun nications Toolbox

Built in parallel functionality within specific toolboxes ( l requires (also i P Parallel ll l Computing Toolbox)

Global Optimization n Toolbox



Optimiza ation Toolbox

Parallel Computing with MATLAB

MATLAB and Parallel Computing Tools



High level parallel functions



Low level parallel functions



Built on industry standard libraries

parfor

matlabpool

batch

jobs, tasks Industry Libraries Message Passing Interface (MPI) ScaLAPACK

22

Parallel Computing on the Desktop Desktop Computer Parallel Computing Toolbox



Rapidly develop parallel applications on local computer



Take full advantage of desktop power by using CPUs and GPUs



Separate computer cluster not required 23

Scale Up to Clusters, Grids and Clouds Computer Cluster Desktop Computer

MATLAB Distributed Computing Server

Parallel Computing Toolbox

Scheduler

24

Volume Correlation Analysis ((Statistics Toolbox)) 



We capture some observations on volumes of futures contracts traded in a certain period of time We are interested in trends in multivariate data x6E

0.00

0.11

0.13

0.07

0.05

0.04

0.04

0.03

0.05

0.06

0.05

0.04

0.04

CL

0.11

0.00

0.10

0.51

0.07

0.34

0.03

0.05

0.03

0.04

0.07

0.03

0.07

ES

0.13

0.10

0.00

0.06

0.03

0.04

0.03

0.02

0.04

0.04

0.04

0.02

0.03

HO

0.07

0.51

0.06

0.00

0.06

0.27

0.02

0.04

0.02

0.02

0.05

0.01

0.04

NG

0.05

0.07

0.03

0.06

0.00

0.03

0.01

0.10

0.02

0.03

0.08

0.01

0.10

RB

0 04 0.04

0 34 0.34

0 04 0.04

0.27 0 27 0.95

0 03 0.03

0 00 0.00

0 01 0.01

0 02 0.02

0 01 0.01

0 02 0.02

0 02 0.02

0 01 0.01

0 02 0.02

ZB

0.04

0.03

0.03

0.02 0.9

0.01

0.01

0.00

0.02

0.26

0.32

0.02

0.10

0.01

ZC

0.03

0.05

0.02

0.04

0.10

0.02

0.02

0.00

0.02

0.03

0.25

0.01

0.24

ZF

0.05

0.03

0.04

0.85 0.02

0.02

0.01

0.26

0.02

0.00

0.45

0.03

0.15

0.03

ZN

0.06

0.04

0.04

0.8 0.02

0.03

0.02

0.32

0.03

0.45

0.00

0.03

0.12

0.02

ZS

0.05

0.07

0.04

0.05 0.75

0.08

0.02

0.02

0.25

0.03

0.03

0.00

0.01

0.34

ZT

0 04 0.04

0 03 0.03

0 02 0.02

0 01 0.01 0.7

0 01 0.01

0 01 0.01

0 10 0.10

0 01 0.01

0 15 0.15

0 12 0.12

0 01 0.01

0 00 0.00

0 01 0.01

ZW

0.04

0.07

0.03

0.04 0.65

0.10

0.02

0.01

0.24

0.03

0.02

0.34

0.01

0.00

x6E

CL

ES

HO

NG

RB

ZB

ZC

ZF

ZN

ZS

ZT

ZW

0.6

0.55

0.5 CL

HO

RB

x6E

ES

NG

ZC

ZS

ZW

ZB

ZF

ZN

ZT

25

Electricity Forecasting 

We capture some observations on temperatures We are interested in forecasting electricity usage

Data & Model Prediction

100



Actual Model

80 60 40 20

0

-20 2004

2005

2006

2007

2008

2009

2010

2008

2009

2010

Residuals 40

20

0

-20

-40 2004

2005

2006

2007

26

Global Optimization Toolbox

27