Ramp Filter in MATLAB

Ramp Filter in MATLAB thumbnail
MATLAB can easily create a linear ramp filter.

MATLAB is a professional software package that provides pre-written functions for technical applications such as digital signal analysis. In signal processing, it is often necessary to filter a signal by altering the contribution of signals with various frequencies. A linear ramp filter is a filter that provides a linearly increasing or decreasing frequency response across a range of frequencies.

  1. Ramp Filter

    • In the frequency domain, a ramp filter is represented by a monotonically increasing function that resembles a ramp. The function is symmetric about zero. When the ramp filter is convolved with another signal it emphasizes either high or low frequencies. The time-domain transform of the ramp filter is a symmetric ringing pulse centered around zero.

    Use

    • Linear ramp filters are used in a variety of optical and medical imaging applications, such as medical image analysis. Because a ramp filter passes frequencies at the peak of the ramp, and excludes or reduces others, it can be used, in practice, as a narrow bandpass filter. Linear ramp filters are commonly used in the analysis of imaging modalities in which backscatter artifacts need to be removed.

    Creation

    • MATLAB does not provide an existing constructor for a linear ramp filter, however, it is easy to create one using basic MATLAB functions. One side of the ramp can be created using the linspace() function, then reversed and combined.

      half_space_size = 128;
      H = linspace(0, 2*pi, half_space_size);
      H_ramp = [H H(end-1:-1:2)];

      The inverse discrete Fourier transform of the ramp filter is then taken, and the filter is normalized to have a maximum intensity of one.

      h_ramp = ifftshift( ifft( H_ramp ) );
      h_ramp = h_ramp / max(h_ramp);

      Far from zero, h_ramp is very close to zero. A subset of h_ramp about zero can be taken to optimize performance without a noticeable decrease in accuracy.

    Applying the Filter

    • Filters can be applied using the convolution operation by executing the conv() function. The "same" option is invoked to return a result that is of the same dimensions as the my_signal variable.

      my_filtered_signal = conv(my_signal, h_ramp,'same');

Related Searches:

References

  • Photo Credit Comstock/Comstock/Getty Images

Comments

Related Ads

Featured