1. MATLAB Introduction and the Working Environment
1.1 MATLAB Introduction
MATLAB is a platform for scientific calculation and high level programming through an interactive environment that allows for accurate resolution of complex calculation tasks more quickly than with traditional programming languages. It is the calculation platform of choice currently used in the sciences and engineering and in many technical business areas.
MATLAB is also a high-level technical computing interactive environment for algorithm development, data visualization, data analysis and numerical calculations. MATLAB is suitable for solving problems of technical calculation using optimized algorithms that for the end user are easy to use commands.
It is possible to use MATLAB in a wide range of applications including mathematical calculus, algebra, statistics, econometrics, quality control, time series, processing of signals and images, communications, design of control systems, test and measurement systems, modeling and financial analysis, computational biology, etc. The complementary toolsets called toolboxes (collections of MATLAB functions for special purposes, which are available separately) extend the environment of MATLAB allowing you to solve special problems in different areas of application.
It is possible to integrate MATLAB code in with other languages and applications, in addition to the distributed algorithms and applications that are developed using MATLAB. Taken together, the functions, commands and programming capabilities of the MATLAB ecosystem are a truly amazing collection.
Following are the important graphics related features of MATLAB:
A high level technical calculation language
A development environment for managing code, files, and data
Interactive tools for exploration, design and iterative solutions
Mathematical functions for linear algebra, statistics, Fourier, filtering, optimization, and numerical integration analysis
Two-dimensional and three-dimensional graphics functions for visualizing data
Tools to create custom graphical user interfaces
Functions to integrate the algorithms based on MATLAB applications with external languages, such as C/C++, Fortran Java, Microsoft .Net, Excel and others.
The MATLAB development environment allows you to develop algorithms and analyze data, display data files and manage projects in an interactive mode featuring the Command Window, which is the hub of activity and is shown in Figure .
1.1.1 Algorithms and Applications Development
MATLAB provides high-level programming language and development tools with which it is possible to develop and utilize algorithms and applications quickly.
The MATLAB language includes vector and matrix operations that are fundamental to solve scientific and engineering problems, streamlined for both development and execution.
With the MATLAB language, it is possible to program and develop algorithms faster than with traditional languages because it is not necessary to perform low level administrative tasks, such as specifying data types and allocating memory. In many cases, MATLAB eliminates the need of for loops using a technique called vectorization. As a result, a line of MATLAB code usually replaces several lines of C or C++ code.
At the same time, MATLAB offers all the features of traditional programming languages, including arithmetic operators, control flow, data structures, data types, object-oriented programming and debugging.
An algorithm for modulation of communications that generates 1024 random bits, performs modulation, adds complex Gaussian noise and graphically represents the result is represented in Figure . All in just lines of code in MATLAB.
MATLAB enables you to execute commands or groups of commands one at a time, with no compile or link, to achieve the optimal solution.
To quickly execute complex vector and matrix calculations, MATLAB uses libraries optimized for the processor. For many of its calculations, MATLAB generates instructions into machine code using JIT ( Just-In-Time ) technology. Thanks to this technology, which is available for most platforms, execution speeds are much faster than with traditional programming languages.
MATLAB includes development tools , which help efficiently implement algorithms. The following are some of them:
MATLAB Editor With editing functions and standard debugging offerings such as setting breakpoints and step by step simulations
M-Lint Code Checker Analyzes the code and recommends changes to improve the performance and maintenance (Figure )
MATLAB Profiler Records the time that it takes to execute each line of code
Directory Reports Scans all files in a directory and creates reports about the efficiency of the code, the differences between files, dependencies of the files and code coverage
You can also use the interactive tool GUIDE ( Graphical User Interface Development Environment ) to design and edit user interfaces. This tool allows you to include pick lists, drop-down menus, push buttons, radio buttons and sliders, as well as MATLAB diagrams and ActiveX controls. You can also create graphical user interfaces by means of programming using MATLAB functions. You can also expose figures or MATLAB algorithms on the web.
Figure shows the analysis of wavelets in the tool user interface using GUIDE (above) and the interface (below) completed.
1.1.2 Data Access and Analysis
MATLAB supports the entire process of data analysis, from the acquisition of data from external devices and databases, pre-processing, visualization and numerical analysis, up to the production of results in presentation quality.
MATLAB provides interactive tools and command line operations for data analysis, which include: sections of data, scaling and averaging, interpolation, thresholding and smoothing, correlation, analysis of Fourier and filtering, search for one-dimensional peaks and zeros, basic statistics and curve fitting, matrix analysis, etc.
Figure shows a diagram that shows a curve adjusted to atmospheric pressure differences averaged between Easter Island and Darwin in Australia.