In this paper, we use convex optimization for model reduction and identification of transfer functions. Two different approximation criteria are studied. When the first criterion is used, magnitude functions are matched, and when the second criterion is used, phase functions are matched. The weighted error bounds have direct interpretation in a Bode diagram, and are suitable to engineers working with frequency-domain data. We also show that transfer functions that have similar magnitude or phase functions have a small relative H-infinity error, under certain stability and minimum phase assumptions. The error bounds come from bounds associated with the Hilbert transform operator restricted in its application to rational transfer functions. Furthermore, it is shown how the approximation procedures can be implemented with linear matrix inequalities, and four examples are included to illustrate the results.