|
1 | | -function pd = imu_test_normality(imu_sta, cdf) |
| 1 | +function pd = imu_test_normality(imu_sta, dec, cdf) |
2 | 2 | % imu_test_normality: performs normality analysis on static inertial |
3 | 3 | % measurements. |
4 | 4 | % |
|
8 | 8 | % wb: Nx3 turn rates [X Y Z] (rad/s). |
9 | 9 | % t: Nx1 time vector (s). |
10 | 10 | % |
| 11 | +% dec, decimation factor (integer) |
11 | 12 | % cdf, 'ON' or 'OFF' (string) |
12 | 13 | % |
13 | 14 | % OUTPUT |
|
34 | 35 | % References: |
35 | 36 | % |
36 | 37 | % |
37 | | -% Version: 001 |
38 | | -% Date: 2021/03/05 |
| 38 | +% Version: 002 |
| 39 | +% Date: 2021/04/01 |
39 | 40 | % Author: Rodrigo Gonzalez <[email protected]> |
40 | 41 | % URL: https://github.com/rodralez/navego |
41 | 42 |
|
42 | | -if nargin < 2, cdf = 'OFF', end |
| 43 | +if nargin < 2, dec = 100; end |
| 44 | + |
| 45 | +if nargin < 3, cdf = 'OFF'; end |
| 46 | + |
| 47 | +fprintf('imu_test_normality: CDF test is %s.\n', cdf ); |
43 | 48 |
|
44 | 49 | %% Test of normality for inertial sensors |
45 | 50 | %% |
46 | 51 |
|
47 | | -% Decimation or downsampling |
48 | | -DEC = 100; |
| 52 | +dec = floor(dec); % Force dec to be integer |
49 | 53 |
|
50 | | -fprintf('imu_test_normality: downsampling ratio is %d.\n', DEC ); |
| 54 | +fprintf('imu_test_normality: downsampling ratio is %d.\n', dec ); |
51 | 55 |
|
52 | | -imu_ds.fb = imu_sta.fb(1:DEC:end, :); |
53 | | -imu_ds.wb = imu_sta.wb(1:DEC:end, :); |
| 56 | +imu_ds.fb = imu_sta.fb(1:dec:end, :); |
| 57 | +imu_ds.wb = imu_sta.wb(1:dec:end, :); |
54 | 58 |
|
55 | 59 | for i=1:3 |
56 | 60 |
|
|
60 | 64 |
|
61 | 65 | x_label = sprintf('FB %d SAMPLES', i); |
62 | 66 | x_title = sprintf('FB %d HISTOGRAM', i); |
63 | | - plot_histogram (data, pd, x_label, x_title); |
| 67 | + plot_histogram (data, pd(i), x_label, x_title); |
64 | 68 |
|
65 | 69 | if ( strcmp(cdf, 'ON') ) |
66 | 70 | x_label = sprintf('FB %d SAMPLES', i); |
67 | 71 | x_title = sprintf('FB %d NORMAL CUMULATIVE DISTRIBUTION', i); |
68 | | - plot_cdf (data, pd_imu_fb(i), x_label, x_title); |
| 72 | + plot_cdf (data, pd(i), x_label, x_title); |
69 | 73 | end |
70 | 74 | end |
71 | 75 |
|
|
77 | 81 |
|
78 | 82 | x_label = sprintf('WB %d SAMPLES', i); |
79 | 83 | x_title = sprintf('WB %d HISTOGRAM', i); |
80 | | - plot_histogram (data, pd, x_label, x_title); |
| 84 | + plot_histogram (data, pd(i+3), x_label, x_title); |
81 | 85 |
|
82 | 86 | if ( strcmp(cdf, 'ON') ) |
83 | | - x_label = sprintf('FB %d SAMPLES', i); |
| 87 | + x_label = sprintf('WB %d SAMPLES', i); |
84 | 88 | x_title = sprintf('WB %d NORMAL CUMULATIVE DISTRIBUTION', i); |
85 | | - plot_cdf (data, pd_imu_wb(i), x_label, x_title); |
| 89 | + plot_cdf (data, pd(i+3), x_label, x_title); |
86 | 90 | end |
87 | 91 | end |
0 commit comments