180 likes | 207 Views
MATLAB Extras. Week 16 – 5/12/09. Kate Musgrave kate@atmos.colostate.edu. Week 13: T 4/21 Intro to MATLAB MATLAB GUI Variables Operations Week 14: T 4/28 Functions and scripts Programming style Comments Flow control File I/O. Week 15: T 5/5 Graphics Plot types Figure window
E N D
MATLAB Extras Week 16 – 5/12/09 Kate Musgrave kate@atmos.colostate.edu
Week 13: T 4/21 Intro to MATLAB MATLAB GUI Variables Operations Week 14: T 4/28 Functions and scripts Programming style Comments Flow control File I/O Week 15: T 5/5 Graphics Plot types Figure window Figure properties Figures: special topics Week 16: T 5/12 MATLAB toolboxes Statistics Signal processing Special topics Syllabus
MATLAB Extras • The basic MATLAB software does not contain many specialized functions – to gain these functions (without writing extensive code yourself) there are two general options: • MATLAB toolboxes • Third-party additions
MATLAB Extras • MATLAB provides a wide range of toolboxes to address specific user needs, of course these toolboxes come at an additional price • Third-party software is (should be) free, and is generally created when fellow users run into problems with things MATLAB hasn’t included – the scripts and packages available are of varying quality
MATLAB Extras • Over time, MATLAB adds to its functionality, so a progression can be seen: third-party toolbox MATLAB core • For example, several years ago FFTs were part of a toolbox, now they are part of core MATLAB; also maps were third-party, now they are a toolbox • Check legacy code to address updates
Communications Control System Curve Fitting Filter Design Fixed-Point Fuzzy Logic Genetic Algortihm Image Acquisition Image Processing Mapping Model Predictive Control Neural Network Optimization Parallel Computing Partial Differential Equation Robust Control Signal Processing Spline Statistics System Identification Wavelet MATLAB Toolboxes Toolboxes available under College of Engineering license (as of version 2009a):
MATLAB Toolboxes • Functions in MATLAB toolboxes are used the same as MATLAB core functions, the use of the toolboxes is ‘transparent’ to the user
MATLAB Toolboxes - Mapping • MATLAB has added a mapping toolbox (many people still prefer third-party software, discussed later) • This toolbox can create figures, but also has a separate mapview GUI, from which you can create maps and save them as images, then import the images back into MATLAB figures
MATLAB Toolboxes – Statistics • Depending on what you are looking to do, this is possibly the single most useful toolbox available – if for no other reason than this toolbox adds the NaN functions • Includes numerical and graphical representations of data • Signal processing toolbox includes correlation, covariance, and spectral analysis functions
Third-party Software • In working with atmospheric data sets, the two most common problems that I’ve seen have been mapping global datasets (or any datasets needing a map) and handling netcdf files. • Third-party software is available for both tasks, though with the latest versions of MATLAB, both of these problems have been addressed (you can use either).
Third-party Software – netcdf • As of version 2009a (also looks like 2008b has netcdf support), handling netcdf files is included in the MATLAB core (for more info, try help netcdf ) • For older versions, scripts can be found at: http://mexcdf.sourceforge.net/http://www.mathworks.com/matlabcentral/fileexchange/15177 (the second link only works for very old, very small netcdf files, but has less overhead than the first)
Third-party Software – Mapping • MATLAB introduced a mapping toolbox at least as early as version 2008a (possibly earlier), but previously we exported data to map (to GRADS, etc.) or used m_map • M_Map – mapping for MATLAB, can be downloaded from this link: http://www.eos.ubc.ca/~rich/map.html • This package has been around for years, and continues to be updated even with the inclusion of a mapping toolbox in MATLAB
M_Map Examples AIRC_map_all.m – maps aircraft reconnaissance data (the eye diameter measured in a hurricane, and the latitude and longitude of the hurricane at that time, stored in AIRC_data.mat), uses different colors depending on eye size
M_Map Examples • Additional examples (including global or regional satellite data from hdf files) can be found on the m_map website, both code and resulting graphics available
Additional Notes • For more information on handling scientific data sets and efficient programming in MATLAB, I suggest checking the Programming Fundamentals section in the MATLAB help
Structures – Additional Notes Structures can contain a wide range of datatypes in their fields, in the following example s is a 1x2 array of structures. Detailed information of structures is available under Programming Fundamentals in MATLAB help.
Structures – Additional Notes • Structures used extensively in managing hdf and netcdf files, learning how to traverse structure hierarchy is very useful when working with these files