Skip to content

Instantly share code, notes, and snippets.

@kusma
Last active January 31, 2017 13:26
Show Gist options
  • Save kusma/2364735904f277aeac19 to your computer and use it in GitHub Desktop.
Save kusma/2364735904f277aeac19 to your computer and use it in GitHub Desktop.
ATAN lut generator
% ATAN lut-generator for Mesa3D
% Based on polyfitc, http://www.mathworks.com/matlabcentral/fileexchange/47851-constraint-polynomial-fit
X = linspace(0, 1);
Y = atan(X)';
N = [1, 3, 5, 7, 9, 11];
lsqM = ones(numel(X), numel(N));
for n = 1:numel(N)
lsqM(:, n) = X.^N(n);
end
P = lsqM \ Y;
format long;
disp(P);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment