Преглед изворни кода

add code to plot high frequency correction filters

Fernando Pablo Lopez-Lezcano пре 9 година
родитељ
комит
db7e551533
1 измењених фајлова са 68 додато и 0 уклоњено
  1. 68 0
      calibration/src/sphear_bf_plot_filters.m

+ 68 - 0
calibration/src/sphear_bf_plot_filters.m

@@ -0,0 +1,68 @@
+%% -*- mode: octave -*-
+%%
+%% *SpHEAR Project
+%%
+%% sphear_bf_plot_filters: plot the shape of WXYZ FIR filters
+%%
+%% usage:
+%%   sphear_bf_plot_filters(FC, W, X, Y, Z)
+%%
+%% FC: array of center frequencies
+%% W, Z, Y: vectors with gains
+%% Z: vector with Z gains (optional)
+%%
+%% Copyright 2016-2017, Fernando Lopez-Lezcano, All Rights Reserved
+%% nando@ccrma.stanford.edu
+%%
+%%  This program is free software: you can redistribute it and/or modify
+%%  it under the terms of the GNU General Public License as published by
+%%  the Free Software Foundation, either version 3 of the License, or
+%%  (at your option) any later version.
+%%
+%%  This program is distributed in the hope that it will be useful,
+%%  but WITHOUT ANY WARRANTY; without even the implied warranty of
+%%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%%  GNU General Public License for more details.
+%%
+%%  You should have received a copy of the GNU General Public License
+%%  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+function sphear_bf_plot_filters(FC, W, X, Y, Z, U, V)
+  fig = figure;
+  %% color plot
+  popts = '.k';
+  wopts = 'k';
+  xopts = 'r';
+  yopts = 'b';
+  zopts = 'g';
+  copt = '-color';
+  cext = "_color";
+  grid on;
+  axis([400, 20000]);
+  xticks = [300, 500, 1000, 2000, 3000, 5000, 7000, 10000, 20000];
+  set(gca, 'XTick', xticks);
+  set(gca, 'XTickLabel', sprintf('%d|', xticks));
+  ca=get (gcf, "currentaxes");
+  set(ca,"fontweight","bold","linewidth",1.5)
+  pbaspect([16, 9, 1])
+  hold on;
+  %% W
+  wh = semilogx(FC, 10*log10(abs(W)), wopts, "linewidth", 1.5);
+  %% XY
+  xh = semilogx(FC, 10*log10(abs(X)), xopts, "linewidth", 1.5);
+  yh = semilogx(FC, 10*log10(abs(Y)), yopts, "linewidth", 1.5);
+  if (exist("Z"))
+    %% Z
+    zh = semilogx(FC, 10*log10(abs(Z)), zopts, "linewidth", 1.5);
+    l = legend([wh, xh, yh, zh], {'W', 'X', 'Y', 'Z'});
+    if (exist("U"))
+      uh = semilogx(FC, 10*log10(abs(U)), 'r--', "linewidth", 1.5);
+      vh = semilogx(FC, 10*log10(abs(V)), 'b--', "linewidth", 1.5);
+      l = legend([wh, xh, yh, zh, uh, vh], {'W', 'X', 'Y', 'Z', 'U', 'V'});
+    end
+  else
+    l = legend([wh, xh, yh], {'W', 'X', 'Y'});
+  end
+  legend(l, 'location', 'south');
+  print(fig, '-deps','-tight',copt,["../data/current/figures/wxyz_simple_filter" cext ".eps"]);
+end