-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_transferFunctionIO.m
More file actions
39 lines (31 loc) · 1.13 KB
/
Copy pathplot_transferFunctionIO.m
File metadata and controls
39 lines (31 loc) · 1.13 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
function [h] = plot_transferFunctionIO(freq,amp,gain,plotParams)
%PLOT_TRANSFERFUNCTION Plot change in spectrum given transfer function.
% PLOT_TRANSFERFUNCTION(FREQ,AMP,GAIN)
if nargin < 1 || isempty(freq), freq = [1 2 3 4].*1000; end
if nargin < 2 || isempty(amp), amp = [10 20 15 5]; end
if nargin < 3 || isempty(gain), gain = [7 15 20 18]; end
if nargin < 4, plotParams = struct; end
defaultParams.freqUnits = 'Hz';
defaultParams.bBlank = 0;
plotParams = set_missingFields(plotParams,defaultParams,0);
plotParams.bLogFreq = 1;
% plot before
h(1) = plot_spectrum(freq,amp,plotParams);
xlim([100 10000]);
set(gca, 'XTickLabel',get(gca,'XTick')); % remove exponents
set(h(1),'Position',[100 100 450 433]);
% plot transfer function
plot_transferFunction(freq,gain,plotParams);
set(gca, 'XTickLabel',get(gca,'XTick')); % remove exponents
% plot after
h(2) = plot_spectrum(freq,amp+gain,plotParams);
xlim([100 10000]);
set(gca, 'XTickLabel',get(gca,'XTick')); % remove exponents
set(h(2),'Position',[100 100 450 433]);
ax2 = gca;
minorTix = ax2.YAxis.MinorTickValues;
copy_ax(h(2),h(1));
h(1)
ax1 = gca;
ax1.YAxis.MinorTickValues = minorTix;
end