Revision 1512
Edited BOM Vector Component Tables with values which will gaurantee that worst case net vector sum will not overflow an integer data type (16 bits).
Also changed Makefile to have TARGET=push_pull. Also added functionality to MATLAB script so that it will automatically calculate the BOM Vector
Component Table given a scalar value.
vectorSizeSpecs.m | ||
---|---|---|
28 | 28 |
|
29 | 29 |
|
30 | 30 |
calc_scalar = (2^(dataBits-1)-1) / (max_net_component * maxIntensity); |
31 |
% calc_scalar = 25.560 => use 25 as scalor
|
|
31 |
% calc_scalar = 25.560 for 16 bits => use 25 as scalar for int data type
|
|
32 | 32 |
|
33 | 33 |
fprintf('With %d data bits, calculated scalar value: %.3f\n\n', dataBits, calc_scalar); |
34 | 34 |
|
... | ... | |
36 | 36 |
% Check worst case |
37 | 37 |
scaled_vector_components = scalar * vector_components; |
38 | 38 |
|
39 |
worst_case = scaled_vector_components * maxIntensity;
|
|
39 |
worst_case = floor(scaled_vector_components) * maxIntensity;
|
|
40 | 40 |
worst_sum = sum(worst_case); |
41 |
fprintf('With scalar %d, max worst case sum: %d\n', scalar, worst_sum);
|
|
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)); |
43 |
|
|
44 |
|
|
45 |
% Calculate the x and y component arrays which should be used in the |
|
46 |
% BOM Vector Component Tables in push_pull.c |
|
47 |
N = 0:15; |
|
48 |
x_comp = floor(scalar * cos(2 * pi / 16 * N)) |
|
49 |
y_comp = floor(scalar * sin(2 * pi / 16 * N)) |
Also available in: Unified diff