function exportCoefs(b, a, filename)

fid = fopen(filename, 'w');
nb = length(b);
fprintf(fid, '#define NB %d\n', nb);
fprintf(fid, 'const float B[NB] = {');
for i = 1:nb-1
    fprintf(fid, '%.8f, ', b(i));
    if mod(i, 3) == 0
        fprintf(fid, '\n');
    end
end
fprintf(fid, '%.8f};\n', b(end));

if ~isempty(a)
    na = length(a);
    fprintf(fid, '\n#define NA %d\n', na);
    fprintf(fid, 'const float A[NA] = {');
    for i = 1:na-1
        fprintf(fid, '%.8f, ', a(i));
        if mod(i, 3) == 0
            fprintf(fid, '\n');
        end
    end
    fprintf(fid, '%.8f};\n', a(end));
end

fclose(fid);

