Chebychev design of an FIR filter given a desired H(w)
n = 20;
m = 15*n;
w = linspace(0,pi,m)';
D = 8.25;
Hdes = exp(-j*D*w);
A = exp( -j*kron(w,[0:n-1]) );
cvx_begin
variable h(n,1)
minimize( max( abs( A*h - Hdes ) ) )
cvx_end
disp(['Problem is ' cvx_status])
if ~strcmp(cvx_status,'Solved')
h = [];
end
figure(1)
stem([0:n-1],h)
xlabel('n')
ylabel('h(n)')
H = [exp(-j*kron(w,[0:n-1]))]*h;
figure(2)
subplot(2,1,1);
plot(w,20*log10(abs(H)),w,20*log10(abs(Hdes)),'--')
xlabel('w')
ylabel('mag H in dB')
axis([0 pi -30 10])
legend('optimized','desired','Location','SouthEast')
subplot(2,1,2)
plot(w,angle(H))
axis([0,pi,-pi,pi])
xlabel('w'), ylabel('phase H(w)')
Calling SeDuMi: 919 variables (20 free), 898 equality constraints
------------------------------------------------------------------------
SeDuMi 1.1 by AdvOL, 2005 and Jos F. Sturm, 1998, 2001-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 20 free variables
eqs m = 898, order n = 641, dim = 940, blocks = 300
nnz(A) = 897 + 23962, nnz(ADA) = 2691, nnz(L) = 1795
Handling 42 + 0 dense columns.
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 5.62E-002 0.000
1 : 8.11E-001 1.88E-002 0.000 0.3348 0.9000 0.9000 0.74 1 1 1.8E+000
2 : 6.76E-001 6.55E-003 0.000 0.3483 0.9000 0.9000 3.34 1 1 2.3E-001
3 : 6.48E-001 2.95E-003 0.000 0.4512 0.9000 0.9000 2.08 1 1 8.2E-002
4 : 7.01E-001 8.48E-004 0.000 0.2870 0.9000 0.9000 1.08 1 1 2.4E-002
5 : 7.07E-001 7.53E-006 0.000 0.0089 0.9990 0.9990 1.04 1 1 2.0E-004
6 : 7.07E-001 1.22E-006 0.097 0.1626 0.9094 0.9000 1.00 1 1 3.6E-005
7 : 7.07E-001 4.29E-008 0.000 0.0350 0.9903 0.9900 1.00 1 1 1.6E-006
8 : 7.07E-001 9.64E-009 0.296 0.2246 0.9187 0.9000 1.00 1 1 3.9E-007
9 : 7.07E-001 2.17E-009 0.050 0.2252 0.9188 0.9000 1.00 1 1 9.7E-008
10 : 7.07E-001 1.88E-012 0.197 0.0009 0.9999 0.9999 1.00 2 2 8.3E-011
iter seconds digits c*x b*y
10 0.9 10.1 7.0710678141e-001 7.0710678135e-001
|Ax-b| = 3.2e-012, [Ay-c]_+ = 4.1E-011, |x|= 1.3e+001, |y|= 1.4e+000
Detailed timing (sec)
Pre IPM Post
8.012E-002 9.113E-001 0.000E+000
Max-norms: ||b||=1, ||c|| = 1,
Cholesky |add|=0, |skip| = 2, ||L.L|| = 1.
------------------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.707107
Problem is Solved