summaryrefslogtreecommitdiff
path: root/gr-utils/octave/plot_freq_response_db.m
blob: 722505b847034a80bffd297fb2df6833756bca75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%
% Copyright 2001 Free Software Foundation, Inc.
%
% This file is part of GNU Radio
%
% SPDX-License-Identifier: GPL-3.0-or-later
%
%

function plot_freq_response_db (b,...)
  if (nargin == 1)
    %% Response of an FIR filter
    a = 1;
  elseif (nargin == 2)
    %% response of an IIR filter
    a = va_arg ();
  endif

  [H,w] = freqz (b,a);

  grid;
  xlabel ('Normalized Frequency (Fs == 1)');
  ylabel ('Magnitude Squared (dB)');
  abs = abs(H);
% plot (w/(2*pi), 20 * log10 (abs/max(abs)));
  plot (w/(2*pi), 20 * log10 (abs));
endfunction