Technical Computing with MATLAB University Of Bath Seminar th 19 th November 2010 Adrienne James (Application Engineering) 1
Agenda Introduction to MATLAB Importing, visualising and analysing data from multiple sources Publishing results to reports Tools for efficient writing, maintaining and sharing of MATLAB routines 2
Data Analysis Tasks Access Explore & Discover Share Automate 3
Computational Finance Workflow Access Files Research and Quantify Data Analysis & Visualization Share Reporting Databases Financial Modeling Applications Datafeeds Application Development 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, scientific Web, XML Applications and languages C/C++, Java, FORTRAN COM,.NET, shared libraries Databases Measurement hardware Data acquisition 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 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
Bringing i external Data into 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 Instrument t Control Toolbox Database Toolbox 13
Signal Processing with MATLAB Signal Processing Toolbox: Filter design, analysis and implementation Transforms Statistical signal processing Spectral analysis Waveform generation Data windowing Linear prediction And more 14
Introduction To MathWorks Deployment Products MATLAB Compiler MATLAB Builder EX MATLAB Builder JA MATLAB Builder NE.exe.dll/.lib Excel Add-in Java www COM.NET 15
Introduction to MATLAB Compiler Automatically packages your MATLAB programs as standalone applications and software components Supports full MATLAB language and most ttoolboxes Allows royalty-free deployment Provides shared infrastructure with MATLAB: Speed of compiled application equivalent to speed in MATLAB 16
Application Deployment Workflow MATLAB Desktop End-User Desktop or Web Server.EXE.EXE 17
High-Throughput Screening Typical goal To observe the reaction of some biological entity of interest (e.g. a protein, some cells, or an embryo) to exposure to multiple treatment conditions (e.g. times, drug compounds) Challenges 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 Converting a batch process to run in parallel l to 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 images by enhancing image characteristics, and reducing the effects of noise and motion. Design and implement 2-D spatial and frequency filters. Extract image features using different methodologies. Identify image objects by using image registration. 20
Parallel Computing Toolbox MATLAB Distributed Computing Server 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
Parallel Computing with MATLAB Built in parallel functionality within specific toolboxes (also requires Parallel l Computing Toolbox) Optimiza ation Toolbox ptimization Global O Toolbox Commun nications Toolbox Statistics Optimiza ation Bioinform matics Toolbox Model-Ba ased Calibrati on Toolbox High level parallel functions MATLAB and Parallel Computing Tools parfor matlabpool batch Low level parallel functions jobs, tasks Built on industry standard libraries 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 Desktop Computer Parallel Computing Toolbox Computer Cluster MATLAB Distributed Computing Server 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 CL ES HO NG RB ZB ZC 0.00 0.11 0.13 0.07 0.05 004 0.11 0.00 0.10 0.51 0.07 034 0.34 0.05 0.13 0.10 0.00 0.06 004 0.07 0.51 0.06 0.00 0.06 027 0.27 0.95 0.9 0.05 0.07 0.06 0.00 003 0.01 0.10 0.34 0.27 000 0.00 0.01 0.01 001 0.01 0.00 0.05 0.10 002 0.00 0.05 001 0.01 0.26 0.06 002 0.32 0.05 0.07 0.05 0.08 002 0.25 0.01 0.01 001 0.01 0.10 0.01 0.07 0.10 002 0.01 0.24 ZF 0.05 0.85 0.01 0.26 0.00 0.45 0.15 ZN 0.06 0.8 0.32 0.45 0.00 0.12 ZS 0.05 0.07 0.75 0.05 0.08 0.25 0.00 0.01 0.34 ZT 004 003 002 001 0.01 0.7 001 0.01 001 0.01 010 0.10 001 0.01 015 0.15 012 0.12 001 0.01 000 0.00 001 0.01 ZW 0.07 0.10 0.01 0.24 0.34 0.01 0.00 0.65 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 100 80 60 40 Data & Model Prediction 20 0 electricity usage -20 2004 2005 2006 2007 2008 2009 2010 Actual Model 40 Residuals 20 0-20 -40 2004 2005 2006 2007 2008 2009 2010 26
Global Optimization Toolbox 27