-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_device_tol.m
58 lines (50 loc) · 1.59 KB
/
run_device_tol.m
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function run_device_tol()
% Read an impedance measurement and evaluate the tolerances.
%
% Read a file generated by a HP/Agilent/Keysight 4294A impedance analyzer.
% Extract the measurement tolerances.
% Plot the measured values and the tolerances.
%
% For the example, a resistive-inductive load is considered.
%
% (c) 2016-2020, ETH Zurich, Power Electronic Systems Laboratory, T. Guillod
close('all')
addpath('utils')
%% param
BW = 5; % bandwidth setting of the impedance analyzer
V_osc = 500e-3; % oscillator voltage of the impedance analyzer
%% get the ranges
f_vec = logspace(log10(1.001.*40), log10(0.999.*110e6), 100);
Z_vec = logspace(log10(1.001.*10e-3), log10(0.999.*100e6), 100);
err_vec = logspace(log10(0.01), log10(100.0), 100);
%% compute the device tolerances
[f_mat, Z_mat] = meshgrid(f_vec, Z_vec);
[tol_abs, tol_rad, is_valid] = tolerance_4294A(f_mat, Z_mat, V_osc, BW);
assert(all(all(is_valid==true)), 'invalid data')
%% plot device tolerances
figure()
subplot(2,1,1)
contourf(f_vec, Z_vec, 100.0.*tol_abs, err_vec, 'Edgecolor', 'none')
hold('on')
set(gca, 'xscale', 'log')
set(gca, 'yscale', 'log')
set(gca,'ColorScale','log')
caxis([1e-1 10])
c = colorbar();
set(c.Label, 'String', 'Abs. Tol. [%]')
xlabel('f [Hz]')
ylabel('Z [Ohm]')
title('Tolerance / Absolute')
subplot(2,1,2)
contourf(f_vec, Z_vec, rad2deg(tol_rad), err_vec, 'Edgecolor', 'none')
hold('on')
set(gca, 'xscale', 'log')
set(gca, 'yscale', 'log')
set(gca,'ColorScale','log')
caxis([1e-1 10])
c = colorbar();
set(c.Label, 'String', 'Angle Tol. [deg]')
xlabel('f [Hz]')
ylabel('Z [Ohm]')
title('Tolerance / Angle')
end