fvtool - Open Filter Visualization Tool

Syntax

fvtool(b,a)
fvtool(b1,a1,b2,a2,...bn,an)
fvtool(Hd1,Hd2,...)
h = fvtool(...)

Description

fvtool(b,a) opens FVTool and computes the magnitude response of the digital filter defined with numerator, b and denominator, a. Using FVTool you can display the phase response, group delay, impulse response, step response, pole-zero plot, and coefficients of the filter. You can export the displayed response to a file with File > Export.

fvtool(b1,a1,b2,a2,...bn,an) opens FVTool and computes the magnitude responses of multiple filters defined with numerators, b1...bn and denominators, a1...an.

fvtool(Hd1,Hd2,...) opens FVTool and computes the magnitude responses of the filters in the dfilt objects Hd1, Hd2, etc. If you have the Filter Design Toolbox™ product installed, you can also use fvtool(H1,H2,...) to analyze quantized filter objects (dfilt with arithmetic set to 'single' or 'fixed'), multirate filter (mfilt) objects, and adaptive filter (adaptfilt) objects.

h = fvtool(...) returns a figure handle h. You can use this handle to interact with FVTool from the command line. See Controlling FVTool from the MATLAB® Command Line below.

FVTool has two toolbars.

Linking to FDATool

In fdatool, selecting View > Filter Visualization Tool or the Full View Analysis toolbar button when an analysis is displayed starts FVTool for the current filter. You can synchronize FDATool and FVTool with the FDAToolLink toolbar button . Any changes made to the filter in FDATool are immediately reflected in FVTool.

Two FDATool link modes are provided via the Set Link Mode toolbar button:

Modifying the Axes

You can change the x- or y-axis units by right-clicking the mouse on the axis label or by right-clicking on the plot and selecting Analysis Parameters. Available options for the axes units are as follows.

PlotX-Axis UnitsY-Axis Units

Magnitude

Normalized Frequency
Linear Frequency
Magnitude
Magnitude(dB)
Magnitude squared
Zero-Phase

Phase

Normalized Frequency
Linear Frequency
Phase
Continuous Phase
Degrees
Radians

Magnitude and Phase

Normalized Frequency
Linear Frequency

(y-axis on left side)

Magnitude
Magnitude(dB)
Magnitude squared
Zero-Phase

(y-axis on right side)

Phase
Continuous Phase
Degrees
Radians

Group Delay

Normalized Frequency
Linear Frequency
Samples
Time

Phase Delay

Normalized Frequency
Linear Frequency
Degrees
Radians

Impulse Response

Samples
Time

Amplitude

Step Response

Samples
Time

Amplitude

Pole-Zero

Real Part

Imaginary Part

Modifying the Plot

You can use any of the plot editing toolbar buttons to change the properties of your plot.

Analysis Parameters are parameters that apply to the displayed analyses. To display them, right-click in the plot area and select Analysis Parameters from the menu. (Note that you can access the menu only if the Edit Plot button is inactive.) The following analysis parameters are displayed. (If more than one response is displayed, parameters applicable to each plot are displayed.) Not all of these analysis fields are displayed for all types of plots:

In addition to the above analysis parameters, you can change the plot type for Impulse and Step Response plots by right-clicking and selecting Line with Marker, Stem or Line from the context menu. You can change the x-axis units by right-clicking the x-axis label and selecting Samples or Time.

To save the displayed parameters as the default values to use when FDATool or FVTool is opened, click Save as default.

To restore the default values, click Restore original defaults.

Data Markers display information about a particular point in the plot. See Using Data Markers for more information.

When FVTool is started from FDATool, you can use Specification Masks to display filter specifications on a Magnitude plot. You can also draw your own specification masks. See Analyzing the Filter for more information.

Overlaying a Response

You can overlay a second response on the plot by selecting Analysis > Overlay Analysis and selecting an available response. A second y-axis is added to the right side of the response plot. The Analysis Parameters dialog box shows parameters for the x-axis and both y-axes. See Example 2 for a sample Analysis Parameters dialog box.

Controlling FVTool from the MATLAB® Command Line

After you obtain the handle for FVTool, you can control some aspects of FVTool from the command line. In addition to the standard Handle Graphics® properties (see Handle Graphics in the MATLAB documentation), FVTool has the following properties:

You can use the following methods with the FVTool handle.

addfilter(h,filtobj) adds a new filter to FVTool. The new filter, filtobj, must be a dfilt filter object. You can specify the sampling frequency of the new filter with addfilter(h,filtobj,'Fs',10).

setfilter(h,filtobj) replaces the filter in FVTool with the filter specified in filtobj. You can set the sampling frequency as described above.

deletefilter(h, index) deletes the filter at the FVTool cell array index location.

legend(h,str1,str2,...) creates a legend in FVTool by associating str1 with filter 1, str2 with filter 2, etc. See legend in the MATLAB documentation for information.

For more information on using FVTool from the command line, see the demo fvtooldemo.

Examples

Example 1

Display the magnitude response of an elliptic filter, starting FVTool from the command line:

[b,a]=ellip(6,3,50,300/500);
fvtool(b,a); 

Example 2

Display and analyze multiple FIR filters, starting FVTool from the command line. Then, display the associated analysis parameters for the magnitude:

b1 = firpm(20,[0 0.4 0.5 1],[1 1 0 0]); 
b2 = firpm(40,[0 0.4 0.5 1],[1 1 0 0]); 
fvtool(b1,1,b2,1); 

Image of the analysis parameters for this example

Example 3

Create a lowpass, equiripple filter of order 20 in FDATool and display it in FVTool.

fdatool          % Start FDATool

Set these parameters in fdatool:

ParameterSetting

Response Type

Lowpass

Design Method

FIR Equiripple

Filter Order

Specify order: 20

Density factor

16

Frequency specifications -- units

Normalized (0 to 1)

Wpass

0.4

Wstop

0.5

Magnitude specifications -- Wpass and Wstop

1

and then click the Design Filter button.

Click the Full View Analysis button to start FVTool.

Example 4

Create an elliptic filter and use some of FVTool's figure handle commands:

[b,a]=ellip(6,3,50,300/500);
h = fvtool(b,a);    % Create handle, h and start FVTool
                    % with magnitude plot

set(h,'Analysis','phase')   % Change display to phase plot

set(h,'Legend','on')         % Turn legend on
legend(h,'Phase plot')       % Add legend text

get(h)               % View all properties
                     % FVTool-specific properties are
                     %  at the end of this list.

                 AlphaMap: [1x64 double]
          CloseRequestFcn: 'closereq'
                    Color: [0.8314 0.8157 0.7843]
                 ColorMap: [64x3 double]
              CurrentAxes: 208.0084
         CurrentCharacter: ''
            CurrentObject: []
             CurrentPoint: [0 0]
             DockControls: 'on'
             DoubleBuffer: 'on'
                 FileName: ''
              FixedColors: [11x3 double]
            IntegerHandle: 'on'
           InvertHardcopy: 'on'
              KeyPressFcn: ''
                  MenuBar: 'none'
              MinColormap: 64
                    Name: 'Filter Visualization Tool - Phase Response'
                 NextPlot: 'new'
              NumberTitle: 'on'
               PaperUnits: 'inches'
         PaperOrientation: 'portrait'
            PaperPosition: [0.2500 2.5000 8 6]
        PaperPositionMode: 'manual'
                PaperSize: [8.5000 11]
                PaperType: 'usletter'
                  Pointer: 'arrow'
        PointerShapeCData: [16x16 double]
      PointerShapeHotSpot: [1 1]
                 Position: [360 292 560 345]
                 Renderer: 'painters'
             RendererMode: 'auto'
                   Resize: 'on'
                ResizeFcn: ''
            SelectionType: 'normal'
                  Toolbar: 'auto'
                    Units: 'pixels'
      WindowButtonDownFcn: ''
    WindowButtonMotionFcn: ''
        WindowButtonUpFcn: ''
              WindowStyle: 'normal'
             BeingDeleted: 'off'
            ButtonDownFcn: ''
                 Children: [15x1 double]
                 Clipping: 'on'
                CreateFcn: ''
                DeleteFcn: ''
               BusyAction: 'queue'
         HandleVisibility: 'on'
                  HitTest: 'on'
            Interruptible: 'on'
                   Parent: 0
                 Selected: 'off'
       SelectionHighlight: 'on'
                      Tag: 'filtervisualizationtool'
            UIContextMenu: []
                 UserData: []
                  Visible: 'on'
          AnalysisToolbar: 'on'
            FigureToolbar: 'on'
                  Filters: {[1x1 dfilt.df2t]}
                     Grid: 'on'
                   Legend: 'on'
               DesignMask: 'off'
                       Fs: 1
          SOSViewSettings: [1x1 dspopts.sosview]
                 Analysis: 'phase'
        OverlayedAnalysis: ''
            ShowReference: 'on'
            PolyphaseView: 'off'
      NormalizedFrequency: 'on'
           FrequencyScale: 'Linear'
           FrequencyRange: '[0, pi)'
           NumberofPoints: 8192
          FrequencyVector: [1x256 double]
               PhaseUnits: 'Radians'
             PhaseDisplay: 'Phase'

See Also

fdatool, sptool

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS