MATLAB Examples

Avoid aliasing when downsampling a signal. If a discrete-time signal's baseband spectral support is not limited to an interval of width radians, downsampling by results in aliasing.

Use downsample to obtain the phases of a signal. Downsampling a signal by M can produce M unique phases. For example, if you have a discrete-time signal, x, with x(0) x(1) x(2) x(3), ..., the M

Upsample a signal and apply a lowpass interpolation filter with interp . Upsampling by L inserts L - 1 zeros between every element of the original signal. Upsampling can create imaging

Use moving average filters and resampling to isolate the effect of periodic components of the time of day on hourly temperature readings, as well as remove unwanted line noise from an

Change the sample rate of a signal. The example has two parts. Part one changes the sample rate of a sinusoidal input from 44.1 kHz to 48 kHz. This workflow is common in audio processing. The

Filter before downsampling to mitigate the distortion caused by aliasing. You can use decimate or resample to filter and downsample with one function. Alternatively, you can lowpass

Several ways to simulate the output of a sample-and-hold system by upsampling and filtering a signal.

Generate widely used periodic and aperiodic waveforms, sequences (impulse, step, ramp), multichannel signals, pulse trains, sinc and Dirichlet functions available in the Signal

The toolbox also provides functions for generating several widely used aperiodic waveforms:

Resample nonuniformly sampled signals to a new uniform rate. It shows how to apply a custom filter on irregularly sampled data to reduce aliasing. It also shows how to use detrending to remove

The toolbox provides functions for generating widely used periodic waveforms:

Since MATLAB® is a programming language, an endless variety of different signals is possible. Here are some statements that generate a unit impulse, a unit step, a unit ramp, and a unit

The pulstran function generates pulse trains from either continuous or sampled prototype pulses. The following example generates a pulse train consisting of the sum of multiple delayed

The function diric computes the Dirichlet function, sometimes called the periodic sinc or aliased sinc function, for an input vector or matrix x . The Dirichlet function is defined by

The sinc function computes the mathematical sinc function for an input vector or matrix x . Viewed as a function of time, or space, the sinc function is the inverse Fourier transform of the

Reconstruct missing data via interpolation, anti-aliasing filtering, and autoregressive modeling.

A naive implementation of the procedure used by hampel to detect and remove outliers. The actual function is much faster.

Upsample a signal and how upsampling can result in images. Upsampling a signal contracts the spectrum. For example, upsampling a signal by 2 results in a contraction of the spectrum by a

Resample a uniformly sampled signal to a new uniform rate. It shows how to reduce the impact of large transients as well as how to remove unwanted high frequency content.

Load a file that contains measurements of the international normalized ratio (INR) performed on a patient over a five-year period. The INR measures the effect of warfarin, a blood thinner

Create a signal, sampled at 4 kHz, that resembles dialing all the keys of a digital telephone. Save the signal as a MATLAB® timetable.

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:

See all countries