Revision 1515
Updated BOM Vector Component Table calculator to round towards 0 instead
of rounding towards -infinity. This makes vector components symmetric
around 0 and within error bound calculations.
vectorSizeSpecs.m | ||
---|---|---|
36 | 36 |
% Check worst case |
37 | 37 |
scaled_vector_components = scalar * vector_components; |
38 | 38 |
|
39 |
worst_case = floor(scaled_vector_components) * maxIntensity;
|
|
39 |
worst_case = fix(scaled_vector_components) * maxIntensity;
|
|
40 | 40 |
worst_sum = sum(worst_case); |
41 | 41 |
fprintf('With scalar %d, max worst case sum: %d\n', scalar, round(worst_sum)); |
42 | 42 |
fprintf('Max number: 2^(%d-1) - 1 = %d\n', dataBits, (2^(dataBits-1)-1)); |
... | ... | |
45 | 45 |
% Calculate the x and y component arrays which should be used in the |
46 | 46 |
% BOM Vector Component Tables in push_pull.c |
47 | 47 |
N = 0:15; |
48 |
x_comp = floor(scalar * cos(2 * pi / 16 * N)) |
|
49 |
y_comp = floor(scalar * sin(2 * pi / 16 * N)) |
|
48 |
x_comp = fix(scalar * cos(2 * pi / 16 * N)) |
|
49 |
y_comp = fix(scalar * sin(2 * pi / 16 * N)) |
Also available in: Unified diff