How to add frequency constraint to filter design example?

Consider the Chebychev filter example from the homepage: http://cvxr.com/cvx/examples/filter_design/html/fir_chebychev_design.html#source

How to add a frequency constraint such that the filter only gets optimized within w_pass and w_stop?

The relevant lines are

% rule-of-thumb frequency discretization (Cheney's Approx. Theory book)
m = 15*n;
w = linspace(0,pi,m)'; % omega

Just modify the linspace command to cover the frequencies of interest. The units are expressed in radians; given a frequency f and a sample rate F_s, the corresponding radian frequency is 2\pi f/F_s.

Make sure you sample your frequency range finely, as we’re doing here.