Revision 1602 trunk/code/projects/fp_math/gentables.m
gentables.m  

1  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)); 

2 
TABLE_LENGTH = 64; 

5  3  
4 
space = int32(round(linspace(0, pi/2, TABLE_LENGTH) * 2^16)); 

5 
costable = int32(round(cos(linspace(0, pi/2, TABLE_LENGTH)) * 2^16)); 

6  
6  7 
space_file = fopen('space_table.txt', 'w'); 
7  8 
cos_file = fopen('cos_table.txt', 'w'); 
8 
sin_file = fopen('sin_table.txt', 'w'); 

9  9  
10  10 
for i=1:length(space) 
11  11 
fprintf(space_file, '%d, ', space(i)); 
...  ...  
20  20 
fprintf(cos_file, '\n'); 
21  21 
end 
22  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 
Also available in: Unified diff