This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Arbitrary Magnitude Filter

Design an FIR filter with the following piecewise frequency response:

  • A sinusoid between 0 and 0.19π rad/sample.

    F1 = 0:0.01:0.19;
    A1 = 0.5+sin(2*pi*7.5*F1)/4;
  • A piecewise linear section between 0.2π rad/sample and 0.78π rad/sample.

    F2 = [0.2 0.38 0.4 0.55 0.562 0.585 0.6 0.78];
    A2 = [0.5 2.3 1 1 -0.2 -0.2 1 1];

  • A quadratic section between 0.79π rad/sample and the Nyquist frequency.

    F3 = 0.79:0.01:1;
    A3 = 0.2+18*(1-F3).^2;

Specify a filter order of 50. Consolidate the frequency and amplitude vectors. To give all bands equal weights during the optimization fit, specify a weight vector of all ones. Open the Filter Designer app.

N = 50;

FreqVect = [F1 F2 F3];
AmplVect = [A1 A2 A3];
WghtVect = ones(1,N/2);

filterDesigner

Use the app to design the filter.

  1. Under Response Type, select the button next to Differentiator. From the drop-down list, choose Arbitrary Magnitude.

  2. Set Design Method to FIR. From the drop-down list, select Least-squares.

  3. Under Filter Order, specify the order as the variable N.

  4. Under Frequency and Magnitude Specifications, specify the variables you created:

    • Freq. vectorFreqVect.

    • Mag. vectorAmplVect.

    • Weight vectorWghtVect.

  5. Click Design Filter.

  6. Right-click the y-axis of the plot and select Magnitude to express the magnitude response in linear units.

See Also

Apps

Functions