MATLAB

Programming and Algorithm Development

MATLAB provides a high-level language and development tools that let you quickly develop and analyze algorithms and applications.

Programming and Developing Algorithms with MATLAB 4:32
Write programs and develop algorithms using the high-level language and development tools in MATLAB®.

The MATLAB Language

The MATLAB language provides native support for the vector and matrix operations that are fundamental to solving engineering and scientific problems, enabling fast development and execution.

With the MATLAB language, you can write programs and develop algorithms faster than with traditional languages because you do not need to perform low-level administrative tasks such as declaring variables, specifying data types, and allocating memory. In many cases, the support for vector and matrix operations eliminates the need for for-loops. As a result, one line of MATLAB code can often replace several lines of C or C++ code.

MATLAB provides features of traditional programming languages, including flow control, error handling, and object-oriented programming (OOP). You can use fundamental data types or advanced data structures, or you can define custom data types.

A communications algorithm that generates 1024 random bits, convert the vector to a transmitted signal, adds complex Gaussian noise, and plots the result in nine lines of MATLAB code.
A communications algorithm that generates 1024 random bits, converts the vector to a transmitted signal, adds complex Gaussian noise, and plots the result in nine lines of MATLAB code.

You can produce immediate results by interactively executing commands one at a time. This approach lets you quickly explore multiple options and iterate to an optimal solution. You can capture interactive steps as scripts and functions to reuse and automate your work.

MATLAB add-on products provide built-in algorithms for signal processing and communications, image and video processing, control systems, and many other domains. By combining these algorithms with your own, you can build complex programs and applications.

Development Tools

MATLAB includes a variety of tools for efficient algorithm development, including:

  • Command Window - Lets you interactively enter data, execute commands and programs, and display results
  • MATLAB Editor - Provides editing and debugging features, such as setting breakpoints and stepping through individual lines of code
  • Code Analyzer - Automatically checks code for problems and recommends modifications to maximize performance and maintainability
  • MATLAB Profiler - Measures performance of MATLAB programs and identifies areas of code to modify for improvement

Additional tools compare code and data files, and provide reports showing file dependencies, annotated reminders, and code coverage.

MATLAB program running in debug mode to diagnose problems.
MATLAB program running in debug mode to diagnose problems.

Integration with Other Languages and Applications

You can integrate MATLAB applications with those written in other languages. From MATLAB, you can directly call code written in C, C++, Java, and .NET. Using the MATLAB engine library, you can call MATLAB code from C, C++, or Fortran applications.

Performance

MATLAB uses processor-optimized libraries for fast execution of matrix and vector computations. For general-purpose scalar computations, MATLAB uses its just-in-time (JIT) compilation technology to provide execution speeds that rival those of traditional programming languages.

To take advantage of multicore and multiprocessor computers, MATLAB provides many multithreaded linear algebra and numerical functions. These functions automatically execute on multiple computational threads in a single MATLAB session, enabling them to execute faster on multicore computers.

You can take further advantage of multicore desktop and other high-performance computing resources such as GPUs and clusters with add-on parallel computing products. These products provide high-level constructs that let you parallelize applications with only minor changes to MATLAB code.

Next: Application Development and Deployment
R2014a

Download the Latest Release

Getting Started with MATLAB 5:07

MATLAB Student