% % Wrapper Matlab script, used to run "design_ellips" and report the results % in a useful manner, so that they can be cut and pasted into C++ code. % Christos Komninakis, June 2003 % clear all, close all; % K = input('Provide # of biquads K (filter order is 2*K), say K=7. :'); des_error = input('Provide desired error, say 0.01:'); disp(['What format would you prefer the output in?']); disp(['Enter: 1 for [a,b,c,d,Ao], as in the paper,']); disp([' 2 for [num, den, A_o], for numerator/denominator polynomial coefs and scaling']); Choice = input(' 3 for [num, den], where the scaling factor is part of the numerator poly:'); % call the function to design the filter: fprintf('\n\n Running the design algorithm,\n'); fprintf(' Please be patient and watch intermediate results...\n\n'); if (Choice == 1), [a, b, c, d, A_o] = design_ellips(K, des_error); fprintf('\n\n'); disp(['Now results you can paste into the C-code:']); for i=1:K, disp(['a[',num2str(i-1),'] = ', num2str(a(i),14),'; b[',num2str(i-1),'] = ', num2str(b(i),14),';']); disp(['c[',num2str(i-1),'] = ', num2str(c(i),14),'; d[',num2str(i-1),'] = ', num2str(d(i),14),';']); end; disp(['A_o = ', num2str(A_o,14),';']); elseif (Choice == 2), [num, den, A_o] = design_ellips(K, des_error); fprintf('\n\n'); disp(['Now results in numerator/denominator/scale factor form:']); for i=1:K+1, disp(['num[',num2str(i-1),'] = ', num2str(num(i),14),'; den[',num2str(i-1),'] = ', num2str(den(i),14),';']); end; disp(['A_o = ', num2str(A_o,14),';']); elseif (Choice == 3), [num, den] = design_ellips(K, des_error); fprintf('\n\n'); disp(['Now results in numerator/denominator form:']); for i=1:K+1, disp(['num[',num2str(i-1),'] = ', num2str(num(i),14),'; den[',num2str(i-1),'] = ', num2str(den(i),14),';']); end; else disp(['Read the messages on your screen, it took time to produce them...']); end;