root / trunk / code / projects / fp_math / gentables.m @ 1579
History | View | Annotate | Download (638 Bytes)
| 1 | |
|---|---|
| 2 | space = int32(round(linspace(0,pi,128) * 2^16)) |
| 3 | costable = int32(round(cos(linspace(0,pi,128)) * 2^16)); |
| 4 | sintable = int32(round(sin(linspace(0,pi,128)) * 2^16)); |
| 5 | |
| 6 | space_file = fopen('space_table.txt', 'w');
|
| 7 | cos_file = fopen('cos_table.txt', 'w');
|
| 8 | sin_file = fopen('sin_table.txt', 'w');
|
| 9 | |
| 10 | for i=1:length(space) |
| 11 | fprintf(space_file, '%d, ', space(i)); |
| 12 | if ~mod(i,8) |
| 13 | fprintf(space_file, '\n'); |
| 14 | end |
| 15 | end |
| 16 | |
| 17 | for i=1:length(costable) |
| 18 | fprintf(cos_file, '%d, ', costable(i)); |
| 19 | if ~mod(i,8) |
| 20 | fprintf(cos_file, '\n'); |
| 21 | end |
| 22 | end |
| 23 | |
| 24 | for i=1:length(sintable) |
| 25 | fprintf(sin_file, '%d, ', sintable(i)); |
| 26 | if ~mod(i,8) |
| 27 | fprintf(sin_file, '\n'); |
| 28 | end |
| 29 | end |
| 30 |