MATLAB Examples

Build a digital voltmeter using MATLAB® Support Package for Raspberry Pi® Hardware.

Build a motion sensor camera using MATLAB® Support Package for Raspberry Pi® Hardware.

Every variable in MATLAB® is an array that can hold many numbers. When you want to access selected elements of an array, use indexing.

Use MATLAB to process images captured from a Raspberry Pi Camera Board module to track a green ball.

Use the MATLAB® Support Package for Arduino® Hardware to use SPI interface to communicate with MCP42010 Digital Potentiometer.

Use array indexing to rasterize text into an existing image.

Use the MATLAB® Support Package for Arduino® Hardware to control servo motors, DC motors and stepper motors using Adafruit motor shield v2.

Use the MATLAB® Support Package for Arduino® Hardware and the I2C interface to communicate with I2C devices.

Implement a closed-loop control algorithm to make a two-wheel LEGO® MINDSTORMS® EV3™ vehicle drive straighter.

Use MATLAB® Support Package for Arduino® Hardware to perform basic operations on the hardware such as turning an LED on and off, blinking LEDs and playing sound on a speaker.

Find the maximum value of a single variable in a data set using mapreduce. It demonstrates the simplest use of mapreduce since there is only one key and minimal computation.

Create an animation of two growing lines. The animatedline function helps you to optimize line animations. It allows you to add new points to a line without redefining existing points.

Write a MATLAB script to implement a collision alarm with LEGO® MINDSTORMS® EV3™ hardware.

Increase the number of digital I/O pins by connecting a MCP23017 I/O expander chip to the Raspberry Pi® hardware.

Use the readtable function to import mixed data from a text file into a table. Then, it shows how to modify and analyze the data in the table.

Use mapreduce to carry out simple logistic regression using a single predictor. It demonstrates chaining multiple mapreduce calls to carry out an iterative algorithm. Since each

Compute the mean of a single variable in a data set using mapreduce. It demonstrates a simple use of mapreduce with one key, minimal computation, and an intermediate state (accumulating

Visualize patterns in a large data set without having to load all of the observations into memory simultaneously. It demonstrates how to compute lower volume summaries of the data that are

Capture and process images from Raspberry Pi® Camera Board module using the MATLAB® Support Package for Raspberry Pi Hardware.

Compute the mean by group in a data set using mapreduce. It demonstrates how to do computations on subgroups of data.

Use the I2C peripheral on Raspberry Pi® hardware to control a 4-digit 7-segment display.

Extract a subset of a large data set.

Use the snapshot function to acquire live images from USB Webcams.

Looks at how we can benchmark the solving of a linear system on the GPU. The MATLAB® code to solve for x in A*x = b is very simple. Most frequently, we use matrix left division, also known as

Benchmark solving a linear system on a cluster. The MATLAB® code to solve for x in A*x = b is very simple. Most frequently, one uses matrix left division, also known as mldivide or the backslash

In this example, we show how to benchmark an application using independent jobs on the cluster, and we analyze the results in some detail. In particular, we:

Runs a MATLAB® benchmark that has been modified for the Parallel Computing Toolbox™ and executes it on the client machine. Fluctuations of 5 or 10 percent in the measured times of repeated

Looks at why it is so hard to give a concrete answer to the question "How will my (parallel) application perform on my multi-core machine or on my cluster?" The answer most commonly given is "It

Runs a MATLAB® benchmark that has been modified for Parallel Computing Toolbox™. We execute the benchmark on our workers to determine the relative speeds of the machines on our distributed

This file demonstrates how to use the Par class object to time the execution time of each PARFOR loop. Here are the steps.

How arrayfun can be used to run a MATLAB® function natively on the GPU. When the MATLAB function contains many element-wise operations, arrayfun can provide improved performance when

Use pagefun to improve the performance of applying a large number of independent rotations and translations to objects in a 3-D environment. This is typical of a range of problems which

Uses Conway's "Game of Life" to demonstrate how stencil operations can be performed using a GPU.

Uses Parallel Computing Toolbox™ to perform a two-dimensional Fast Fourier Transform (FFT) on a GPU. The two-dimensional Fourier transform is used in optics to calculate far-field

Measure some of the key performance characteristics of a GPU.

Uses Parallel Computing Toolbox™ to perform a Fast Fourier Transform (FFT) on a GPU. A common use of FFTs is to find the frequency components of a signal buried in a noisy time-domain signal.

Switch between the different random number generators that are supported on the GPU and examines the performance of each of them.

How prices for financial options can be calculated on a GPU using Monte-Carlo methods. Three simple types of exotic option are used as examples, but more complex options can be priced in a

Demonstrates how advanced features of the GPU can be accessed using MEX files. It builds on the example Stencil Operations on a GPU. The previous example uses Conway's "Game of Life" to

Find out the number of CUDA devices in your machine, how to choose which device MATLAB® uses, and how to query the properties of the currently selected device.

How a simple, well-known mathematical problem, the Mandelbrot Set, can be expressed in MATLAB® code. Using Parallel Computing Toolbox™ this code is then adapted to make use of GPU hardware

How the Parallel Computing Toolbox™ can be used to perform pairwise sequence alignment (PWSA). PWSA has multiple applications in bioinformatics, such as multiple sequence analysis and

Pairwise sequence alignment (PWSA). PWSA has multiple applications in bioinformatics, such as multiple sequence analysis and phylogenetic tree reconstruction. We look at a PWSA that

In this example we see how to use callback functions in the Parallel Computing Toolbox™ to notify us when a task has completed and to update graphics when task results are available. We also see

Use the parallel profiler. It is intended to be a quick-start guide to using the parallel profiler graphical user interface (GUI) and its basic commands. Links are provided to the other

The Parallel Computing Toolbox™ enables us to execute our MATLAB® programs on a cluster of computers. In this example, we look at how to divide a large collection of MATLAB operations into

Fit an exponential model to data using the fit function.

Use anovan to fit models where a factor's levels represent a random selection from a larger (infinite) set of possible levels.

Fit and compare polynomials up to sixth degree using Curve Fitting Toolbox, fitting some census data. It also shows how to fit a single-term exponential equation and compare this to the

Generate a nonlinear classifier with Gaussian kernel function. First, generate one class of points inside the unit disk in two dimensions, and another class of points in the annulus from

In this example, use a database of 1985 car imports with 205 observations, 25 predictors, and 1 response, which is insurance risk rating, or "symboling." The first 15 variables are numeric

Use the fit function to fit polynomials to data. The steps fit and plot polynomial curves and a surface, specify fit options, return goodness of fit statistics, calculate predictions, and

Compute and plot the pdf of a Poisson distribution with parameter lambda = 5 .

Use Cook's Distance to determine the outliers in the data.

Work with a curve fit.

Perform linear and quadratic classification of Fisher iris data.

Use copulafit to calibrate copulas with data. To generate data Xsim with a distribution "just like" (in terms of marginal distributions and correlations) the distribution of data in the

Similar to the bootstrap is the jackknife, which uses resampling to estimate the bias of a sample statistic. Sometimes it is also used to estimate standard error of the sample statistic. The

Fit a function to data using lsqcurvefit together with MultiStart .

Find the indices of the three nearest observations in X to each observation in Y with respect to the chi-square distance. This distance metric is used in correspondence analysis,

Perform N-way ANOVA on car data with mileage and other information on 406 cars made between 1970 and 1982.

Plot the pdf of a bivariate Student's t distribution. You can use this distribution for a higher number of dimensions as well, although visualization is not easy.

Compute and plot the pdf using four different values for the parameter r , the desired number of successes: .1 , 1 , 3 , and 6 . In each case, the probability of success p is .5 .

Use a random subspace ensemble to increase the accuracy of classification. It also shows how to use cross validation to determine good parameters for both the weak learner template and the

As for all discrete distributions, the cdf is a step function. The plot shows the discrete uniform cdf for N = 10.

You can also use ensembles of decision trees for classification. For this example, use ionosphere data with 351 observations and 34 real-valued predictors. The response variable is

Create a classification tree ensemble for the ionosphere data set, and use it to predict the classification of a radar return with average measurements.

Use the fit function to fit a Fourier model to data.

Compare the effects of excluding outliers and robust fitting. The example shows how to exclude outliers at an arbitrary distance greater than 1.5 standard deviations from the model. The

Explores more in-depth interaction with the Gazebo® Simulator from MATLAB®. Topics include creating simple models, adding links and joints to models, connecting models together, and

Use the command line features of anfis on a chaotic time-series prediction example.

Create a flight animation for a trajectory using a FlightGear Animation object.

Implement a steady, viscous flow through an insulated, constant-area duct using the Aerospace Toolbox™ software. This flow is also called Fanno line flow.

Visualize aircraft takeoff and chase helicopter with the virtual reality animation object. In this example, you can use the Aero.VirtualRealityAnimation object to set up a virtual

Demonstrates how to control a robot to follow a desired path using a Robot Simulator. The example uses the Pure Pursuit path following controller to drive a simulated robot along a

Set up the Gazebo® simulator engine. This example prepares you for further exploration with Gazebo and also for exploration with a simulated TurtleBot®.

The primary mechanism for ROS nodes to exchange data is to send and receive messages. Messages are transmitted on a topic and each topic has a unique name in the ROS network. If a node wants to

Demonstrates how to compute an obstacle free path between two locations on a given map using the Probabilistic Roadmap (PRM) path planner. PRM path planner constructs a roadmap in the free

Use the Aerospace Toolbox™ functions to determine heat transfer and mass flow rate in a ramjet combustion chamber.

This case study illustrates Kalman filter design and simulation. Both steady-state and time-varying Kalman filters are considered.

Interact with the Gazebo® Simulator from MATLAB®. It shows how to pause the Gazebo simulation, read the physics properties, and retrieve information about objects in the Gazebo world.

Visualize simulated versus actual flight trajectories with the animation object (Aero.Animation) while showing some of the animation object functionality. In this example, you can use

Model objects can represent individual components of a control architecture, such as the plant, actuators, sensors, or controllers. You can connect model objects to build aggregate

Load flight data and estimate G forces during the flight.

Messages are the primary container for exchanging data in ROS. Topics (see docid:robotics_examples.example-ROSPublishAndSubscribeExample) and services (see

Use the method of characteristics and Prandtl-Meyer flow theory to solve a problem in supersonic flow involving expansions. Solve for the flow field downstream of the exit of a supersonic

Visualize contour plots of the calculated values for the Earth's magnetic field using World Magnetic Model 2015 (WMM-2015) overlaid on maps of the Earth. The Mapping Toolbox™ software is

Calculate the required compressor power in a supersonic wind tunnel.

Convert a discrete-time system to continuous time using d2c, and compares the results using two different interpolation methods.

A rosbag or bag is a file format in ROS for storing message data. These bags are often created by subscribing to one or more ROS topics, and storing the received message data in an efficient file

Keyboard control of the TurtleBot® through the use of the ExampleHelperTurtleBotCommunicator class. The instructions describe how to set up the object and how to start the keyboard

Explores MATLAB® control of the Gazebo® Simulator.

Lowpass filter an ECG signal that contains high frequency noise.

Multiple-Input-Multiple-Output (MIMO) systems, which use multiple antennas at the transmitter and receiver ends of a wireless communication system. MIMO systems are increasingly

Simulate a basic communication system in which the signal is first QPSK modulated and then subjected to Orthogonal Frequency Division Multiplexing. The signal is then passed through an

Design lowpass filters. The example highlights some of the most commonly used command-line tools in the DSP System Toolbox. Alternatively, you can use the Filter Builder app to implement

Use the Communications System Toolbox to visualize signal behavior through the use of eye diagrams and scatter plots. The example uses a QPSK signal which is passed through a square-root

How multiple Channel State Information (CSI) processes provide the network with feedback for Coordinated Multipoint (CoMP) operation. In this example User Equipment (UE) data is

Use System objects to do streaming signal processing in MATLAB. The signals are read in and processed frame by frame (or block by block) in each processing loop. You can control the size of each

Demonstrates how to measure the Channel Quality Indicator (CQI) reporting performance using the LTE System Toolbox™ under conformance test conditions as defined in TS36.101 Section

Implement a speech compression technique known as Linear Prediction Coding (LPC) using DSP System Toolbox™ functionality available at the MATLAB® command line.

Design lowpass FIR filters. Many of the concepts presented here can be extended to other responses such as highpass, bandpass, etc.

Compute the time-domain response of a simple bandpass filter:

Use the Complementary Cumulative Distribution Function (CCDF) System object to measure the probability of a signal's instantaneous power being greater than a specified level over its

The example performs Huffman encoding and decoding using a source whose alphabet has three symbols. Notice that the huffmanenco and huffmandeco functions use the dictionary created by

Calculate the cascaded gain, noise figure, and 3rd order intercept (IP3) of a chain of RF stages. Each stage is represented by a frequency independent "black box", specified with its own

How an over-the-air LTE waveform can be generated and analyzed using the LTE System Toolbox™, the Instrument Control Toolbox™ and a Keysight Technologies® RF signal generator and

Use the Least Mean Square (LMS) algorithm to subtract noise from an input signal. The LMS adaptive filter uses the reference signal on the Input port and the desired signal on the Desired port

Use wavelets to analyze electrocardiogram (ECG) signals. ECG signals are frequently nonstationary meaning that their frequency content changes over time. These changes are the events of

Generate an Enhanced Physical Downlink Control Channel (EPDCCH) transmission using the LTE System Toolbox™.

Provides visualization capabilities to see the effects of RF impairments and corrections in a satellite downlink. The link employs 16-QAM modulation in the presence of AWGN and uses a High

Demonstrates how to measure the Rank Indicator (RI) reporting performance using the LTE System Toolbox™ under conformance test conditions as defined in TS36.101 Section 9.5.1.1 [ 1 ].

A digital communications system using QPSK modulation. In particular, this example illustrates methods to address real-world wireless communications issues like carrier frequency and

A method for digital communication with OFDM synchronization based upon the IEEE 802.11a standard. System objects from the Communication System Toolbox are utilized to provide OFDM

Use the LTE System Toolbox™ to create a frame worth of data, pass it through a fading channel and perform channel estimation and equalization. Two figures are created illustrating the

Create a South-polar Stereographic Azimuthal projection map extending from the South Pole to 20 degrees S, centered on longitude 150 degrees West. Include a value for the Origin property in

Display vector maps as lines or patches (filled-in polygons). Mapping Toolbox functions let you display patch vector data that uses NaNs to separate closed regions.

Create a new regular data grid that covers the region of the geolocated data grid, then embed the color data values into the new matrix. The new matrix might need to have somewhat lower

Manipulate displayed map objects by name. Many functions assign descriptive names to the Tag property of the objects they create. The namem and related functions allow you to control the

Create a range of different maps using mapshow.

Construct a map of major world cities enhanced with coastlines and terrain. It uses the modified azimuthal Briesemeister map projection. The example includes some optional code that

Illustrates how to import and display geographic data that contain coordinates in a projected coordinate reference system.

There are many geospatial data sets that contain data with coordinates in latitude and longitude in units of degrees. This example illustrates how to import geographic data with

Create a range of different maps using geoshow .

This function Antarctic Circumpolar Current Fronts as identified by Orsi, A. H., T. Whitworth III and W. D. Nowlin, Jr., 1995: On the meridional extent and fronts of the Antarctic

Fit gridded data to fine and coarse graticules. The choice of graticule is a balance of speed over precision in terms of positioning the grid on the map. Typically, there is no point to

Combine an elevation data grid and an attribute (color) data grid that cover the same region but are gridded differently. The example drapes slope data from a regular data grid on top of

Create simple maps using the worldmap function. The example uses sample data sets included in the matlabroot/toolbox/map/mapdata folder.

Create a map with a long, narrow, oblique Mercator projection. The example shows the area 10 degrees to either side of the great-circle flight path from Tokyo to New York. You can't use

Create maps of the United States using the usamap function. The usamap function lets you make maps of the United States as a whole, just the conterminous portion (the "lower 48" states),

Change the projection of a map and update the meridian and parallel labels.

Construct an Orthographic projection map with the origin centered near Paris, France. You can't use MapLatLimit or MapLonLimit here.

Specify the map projection origin and frame limits using the two map limit properties: MapLatLimit and MapLonLimit . While the map axes supports properties to set these values directly,

Create a map of the standard version of the Lambert Conformal Conic projection covering latitudes 20 North to 75 North and longitudes covering 90 degrees starting at 30 degrees West.

Create an opaque surface over which you can display line and point data. This can be useful with Globe displays that depict 3-D objects. You can see into and through them as long as no opaque

Set up map axes.

The figure of the Earth (the geoid data set) draped on topographic relief (the topo data set). The geoid data is shown as an attribute (using a color scale) rather than being depicted as a 3-D

Add a light source to a surface colored data grid. The toolbox manages light objects with the lightm function.

Use CAN channels to transmit and receive CAN messages. It uses MathWorks Virtual CAN channels connected in a loopback configuration.

Create, receive and process messages using information stored in CAN database files. This example uses the CAN database file, demoVNT_CANdbFiles.dbc.

Use XCP connections to create and use dynamic data acquisition lists. It uses a freely available XCP slave simulator from Vector and Vector Virtual CAN channels. It is also recommended to run

Use XCP connections to directly acquire measurement values from a slave. It uses a freely available XCP slave simulator from Vector and Vector Virtual CAN channels. It is also recommended to

Use the automated CAN message transmit features of Vehicle Network Toolbox™ to send messages on event. It uses MathWorks Virtual CAN channels connected in a loopback configuration. As this

Use Vehicle Network Toolbox™ with J1939 to create and manage J1939 parameter groups using information stored in CAN database files. This example uses the CAN database file, J1939.dbc.

Read channel data from an MDF file.

Configure and use a callback function to receive and process messages received from a CAN channel. It uses MathWorks Virtual CAN channels connected in a loopback configuration.

Use Vehicle Network Toolbox™ with J1939 to create and use J1939 channels to transmit and receive parameter groups on a network. This example uses the CAN database file, J1939.dbc. It also

Use CAN message filters to allow only messages that contain specified identifiers to pass through a channel. It uses MathWorks Virtual CAN channels connected in a loopback configuration.

Access information stored in A2L files for use with XCP connections. It uses a freely available XCP slave simulator from Vector and Vector Virtual CAN channels.

Open MDF files and access information about the file and its contents.

Use Vehicle Network Toolbox™ with the InitialTimestamp CAN channel property to work with relative and absolute timestamps for CAN messages. It also uses MathWorks Virtual CAN channels

Use the automated CAN message transmit features of Vehicle Network Toolbox™ to send periodic messages. It uses MathWorks Virtual CAN channels connected in a loopback configuration. As

Investigate vehicle battery power during discharge mode across various drive cycles. The data for this analysis are contained in a set of vehicle log files in MDF format. For this example, we

Use CAN FD channels to transmit and receive CAN FD messages. It uses MathWorks Virtual CAN channels connected in a loopback configuration.

Execute a forward collision warning (FCW) application with sensor and vision data replayed live via CAN FD and TCP/IP protocols. For assistance with the design and development of FCW

Use the MDF Datastore feature of Vehicle Network Toolbox to quickly and efficiently process a data set spread across a collection of multiple MDF files. This workflow is also valuable when

Log and replay CAN messages using MathWorks Virtual CAN channels in Simulink®. You can update this model to connect to supported hardware on your system.

Uses MathWorks Virtual CAN channels to set up periodic transmit and reception of CAN messages, using Simulink®. The Virtual channels are connected in a loopback configuration.

Use J1939 blocks to directly send and receive Parameter Group (PG) messages in Simulink®.

Use XCP blocks to directly acquire measurement values from a slave in Simulink®. It uses an XCP slave simulator available for free download from Vector, and Vector Virtual CAN channels.

Set up CAN communication between host-side CAN Vector blocks and target models. This example uses:

Inspect a squared residual series for autocorrelation by plotting the sample autocorrelation function (ACF) and partial autocorrelation function (PACF). Then, conduct a Ljung-Box

Assess whether a time series is a random walk. It uses market data for daily returns of stocks and cash (money market) from the period January 1, 2000 to November 7, 2005.

Compute and plot the impulse response function for an autoregressive (AR) model. The AR ( p ) model is given by

To illustrate assigning property values, consider specifying the AR(2) model

Do goodness of fit checks. Residual diagnostic plots help verify model assumptions, and cross-validation prediction checks help assess predictive performance. The time series is

Conduct the Ljung-Box Q-test for autocorrelation.

Estimate a multivariate time series model that contains lagged endogenous and exogenous variables, and how to simulate responses. The response series are the quarterly:

Test a univariate time series for a unit root. It uses wages data (1900-1970) in the manufacturing sector. The series is in the Nelson-Plosser data set.

Estimate a seasonal ARIMA model:

Use arima to specify a multiplicative seasonal ARIMA model (for monthly data) with no constant term.

Specify a composite conditional mean and variance model using arima .

Conduct a likelihood ratio test to choose the number of lags in a GARCH model.

Calculate the required inputs for conducting a Lagrange multiplier (LM) test with lmtest . The LM test compares the fit of a restricted model against an unrestricted model by testing whether

Check whether a linear time series is a unit root process in several ways. You can assess unit root nonstationarity statistically, visually, and algebraically.

Conduct Engle's ARCH test for conditional heteroscedasticity.

Estimate the parameters of a vector error-correction (VEC) model. Before estimating VEC model parameters, you must determine whether there are any cointegrating relations (see

Apply both nonseasonal and seasonal differencing using lag operator polynomial objects. The time series is monthly international airline passenger counts from 1949 to 1960.

Generate data from a known model, specify a state-space model containing unknown parameters corresponding to the data generating process, and then fit the state-space model to the data.

Specify a conditional variance model for daily Deutschmark/British pound foreign exchange rates observed from January 1984 to December 1991.

Compare two competing, conditional variance models using a likelihood ratio test.

Calculate the required inputs for conducting a Wald test with waldtest . The Wald test compares the fit of a restricted model against an unrestricted model by testing whether the restriction

Specify an ARIMAX model using arima .

Smooth states of a time-invariant, state-space model that contains a regression component.

In this example, you will use the parameter estimation capabilities of SimBiology™ to calculate F, the bioavailability, of the drug ondansetron. You will calculate F by fitting a model of

Construct a simple model with two species (A and B) and a reaction. The reaction is A -> B , which follows the mass action kinetics with the forward rate parameter k . Hence the rate of change is $

Perform a Monte Carlo simulation of a pharmacokinetic/pharmacodynamic (PK/PD) model for an antibacterial agent. This example is adapted from Katsube et al. [1] This example also shows how

Build a simple nonlinear mixed-effects model from clinical pharmacokinetic data.

Simulate and analyze a model in SimBiology® using a physiologically based model of the glucose-insulin system in normal and diabetic humans.

Use the sbioconsmoiety function to find conserved quantities in a SimBiology® model.

Build, simulate and analyze a model in SimBiology® using a pathway taken from the literature.

Make ensemble runs and how to analyze the generated data in SimBiology®.

Deploy a graphical application that simulates a SimBiology model. The example model is the Lotka-Volterra reaction system as described by Gillespie [1], which can be interpreted as a

Perform a parameter scan by simulating a model multiple times, each time varying the value of a parameter.

Correctly build a SimBiology® model that contains discontinuities.

Build and simulate a model using the SSA stochastic solver.

Build and simulate a model using the SSA stochastic solver and the Explicit Tau-Leaping solver.

Configure sbiofit to perform a hybrid optimization by first running the global solver particleswarm , followed by another minimization function, fmincon .

Increase the amount or concentration of a species by a constant value using the zero-order rate rule. For example, suppose species x increases by a constant rate k . The rate of change is:

Change the amount of a species similar to a first-order reaction using the first-order rate rule. For example, suppose the species x decays exponentially. The rate of change of species x is:

Create a rate rule where a species from one reaction can determine the rate of another reaction if it is in the second reaction rate equation. Similarly, a species from a reaction can determine

Generate bootstrap replicates of DNA sequences. The data generated by bootstrapping is used to estimate the confidence of the branches in a phylogenetic tree.

An analysis of the origin and diffusion of the SARS epidemic. It is based on the discussion of viral phylogeny presented in Chapter 7 of "Introduction to Computational Genomics. A Case

Construct phylogenetic trees from multiple strains of the HIV and SIV viruses.

How the analysis of synonymous and nonsynonymous mutations at the nucleotide level can suggest patterns of molecular adaptation in the genome of HIV-1. This example is based on the

Construct phylogenetic trees from mtDNA sequences for the Hominidae taxa (also known as pongidae). This family embraces the gorillas, chimpanzees, orangutans and humans.

Generate a standalone C library from MATLAB code that implements a simple Sobel filter that performs edge detection on images. The example also shows how to generate and test a MEX function in

The recommended workflow for generating C code from a MATLAB function using the 'codegen' command. These are the steps: 1. Add the %#codegen directive to the MATLAB function to indicate that

Generate C code for a MATLAB Kalman filter function,'kalmanfilter', which estimates the position of a moving object based on past noisy measurements. It also shows how to generate a MEX

Generate HDL code from a MATLAB® design that does image enhancement using histogram equalization.

Use the HDL Coder™ to generate a custom HDL IP core which blinks LEDs on the Arrow® SoCKit® evaluation kit, and shows how to use Embedded Coder® to generate C code that runs on the ARM® processor

Compute square root using a CORDIC kernel algorithm in MATLAB®. CORDIC-based algorithms are critical to many embedded applications, including motor controls, navigation, signal

Generate a standalone C library from MATLAB code that reads a file from disk using the standard C functions fopen/fread/fclose. To call these C functions, the MATLAB code uses the

HDL code generation from a floating-point MATLAB® design that is not ready for code generation in two steps. First we use float2fixed conversion process to generate a lookup table based

Generate HDL code from a MATLAB® design that implements an LMS filter. It also shows how to design a testbench that implements noise cancellation using this filter.

Use MATLAB® HDL Workflow Advisor to generate a custom HDL IP core which blinks LEDs on FPGA board. The generated IP core can be used on Xilinx® Zynq® platform, or on any Xilinx FPGA with

Generate a MEX function from a simple MATLAB function using the 'codegen' command. You can use 'codegen' to check that your MATLAB code is suitable for code generation and, in many cases, to

Generate HDL code from a MATLAB® design implementing the adaptive median filter algorithm suited for HDL code generation.

Generate HDL code from MATLAB® design implementing an bisection algorithm to calculate the square root of a number in fixed point notation.

Use the CORDIC algorithm, polynomial approximation, and lookup table approaches to calculate the fixed-point, four quadrant inverse tangent. These implementations are approximations

Convert a textbook version of the Fast Fourier Transform (FFT) algorithm into fixed-point MATLAB® code.

Use the HDL Coder™ to generate a custom HDL IP core which blinks LEDs on the Xilinx® Zynq® ZC702 evaluation kit, and shows how to use Embedded Coder® to generate C code that runs on the ARM®

Use both CORDIC-based and lookup table-based algorithms provided by the Fixed-Point Designer™ to approximate the MATLAB® sine (SIN) and cosine (COS) functions. Efficient fixed-point

Generate a MEX function and C source code from MATLAB code that performs portfolio optimization using the Black Litterman approach.

Generate HDL code from a MATLAB® design implementing a RGB2YUV conversion.

These examples are using Einstein's General Relativity to calculate geodesics in curved space-time.

Work with MATLAB® HDL Coder™ projects to generate HDL from MATLAB designs.

Accelerate fixed-point algorithms using fiaccel function. You generate a MEX function from MATLAB® code, run the generated MEX function, and compare the execution speed with MATLAB code

Use code replacement libraries to replace operators and functions in the generated code. The MATLAB code described illustrates the replacement capabilities. With each example MATLAB

Illustrates how to set the width of the page margins of a Microsoft Word report.

Illustrates a functional approach to creating a report generator based on the DOM API. It uses the DOM API to create a MATLAB function, rptmagic, that generates a PDF, HTML, or a Microsoft Word

Illustrates an object-oriented approach to creating a report generator based on the DOM API. It uses the DOM API to create pair of MATLAB classes, MagicSquareReport and

The DOM API supports, but does not require, use of templates to generate reports. As this example illustrates, you can use the API to create scripts that generate and format content without

Illustrates a report generator created with the help of the Report Explorer, the Report Generator's interactive report generation program designer. The report generator in this example

The Report Generator's PowerPoint API allows you to create MATLAB applications that present results as Microsoft PowerPoint presentations. This examples shows the use of the API to create

The MATLAB Report Generator's report generation API supports creation of finders that search data containers for specified objects and return the results in reportable form. Finders

Determines the minimum arrival delay using a large set of flight data that is stored in a database.

Determines the mean arrival delay of a large set of flight data that is stored in a database using MapReduce. You can access large data sets using a DatabaseDatastore object with Database

Create a DatabaseDatastore object for accessing collections of data stored in a relational database. After creating a DatabaseDatastore object, you can preview data, read data in chunks,

Move data between MATLAB® and the MATLAB® interface to SQLite. Suppose that you have product data that you want to import into MATLAB®. You can load this data quickly into a SQLite database

Import data from a database into MATLAB®, perform calculations on the data, and export the results to a database table.

Import Boolean data from a database table into the MATLAB® workspace. MATLAB® imports Boolean data from databases into the MATLAB® workspace as data type logical. This data has values of

Retrieve database information using the connection object and the sqlfind function.

Import data from a table in a Microsoft® Access™ database into the MATLAB® workspace using the sqlread function. The example then shows how to use an SQL script to import data from an SQL query

Traverse a graph and explore its structure using the MATLAB® interface to Neo4j®. For details about the MATLAB interface to Neo4j, see docid:database_ug.bveys16-1.

Add a group of colleagues, stored as a directed graph, to a group of friends in a social neighborhood, stored as nodes and relationships in a Neo4j® database. The example then shows how to query

Create, update, and delete information in a social neighborhood, which is represented by a Neo4j® database, using the MATLAB® interface to Neo4j.

Search a social neighborhood to find the second-degree friends of a person, using the MATLAB® interface to Neo4j®. Assume that you have graph data that is stored on a Neo4j® database which

Analyze dependencies among services in a network using the MATLAB® interface to Neo4j®. Assume that you have graph data that is stored on a Neo4j® database which represents a network. This

Search a social neighborhood to find the shortest path between people, using the MATLAB® interface to Neo4j®. Assume that you have graph data that is stored on a Neo4j® database which

Importing data from a variety of sources and aligning / cleaning up the data consumes a significant portion of an analyst workflow. It can be challenging to align and synchronize data from

Ideas for trading strategies can very often be generated by visual exploration of the price data. MATLAB's interactive plotting tools enable analysts to quickly visualize and explore

Demonstrates building and validating a short term electricity load forecasting model with MATLAB. The models take into account multiple sources of information including temperatures

Demonstrates an alternate model for building relationships between historical weather and load data to build and test a short term load forecasting. The model used is a set of aggregated

Demonstrates building and validating a short term electricity price forecasting model with MATLAB using Neural Networks. The models take into account multiple sources of information

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.