# Loudspeaker crossover network using Sallen key filters (MATLAB transfer functions)

I am currently trying to model an active Linkwitz-Riley crossover network using cascaded Sallen-Key lowpass (LP) and highpass (HP) filters.

I can get plots simulated in MATLAB of both transfer functions, however using the same RC values for the HP and LP I thought would cause both to have the same cutoff frequency so that when put together they would cause no gain loss across the system.

However, this is not the case seen. I have used the transfer functions explained in Texas Instruments paper, however they are adapted to not include resistors 3 and 4: http://www.ti.com/lit/an/sloa024b/sloa024b.pdf

I am currently just using the transfer function for a singular Sallen-Key filter in the hopes of once this is sorted I can then simply cascade them.

The MATLAB code for the transfer functions is as follows :

function H = transferLP(R,C,f)
s = 1j.*2.*pi.*f;
RC = R.*C;
H = 1./((s.^2).*(RC.^2) + (s.*(RC + RC + RC)) + 1);
end

function H = transferHP(R,C,f)
s = 1j.*2.*pi.*f;
RC = R.*C;
H = ((s.^2).*(RC.^2))./((s.^2).*(RC.^2) + (s.*(RC + RC + RC)) + 1);
end


Taking the real part (real(h)) of the result of these functions should obtain the magnitude information while the imaginary part (imag(h)) should contain the phase information.

f = frequency vector R = resistor values C = capacitor values (Keep R & C the same i know you can change them individually)

The plot I get out for the magnitude is as follows. As a side note I was also wondering why the gain dips below 0; is this a ripple in the stop band because I'm using a second order filter?

Thanks for the help in advance.

## 1 Answer

I thought would cause both to have the same cutoff frequency so that when put together they would cause no gain loss across the system.

The definition of the cutoff frequency is not the same for all filters. For Butterworth it's the -3 dB point. But for Linkwitz-Riley filters it is the -6 dB point ! So you might think your filter is incorrect but it might just follow the LR-filter's intentions.

Also you should plot the Gain on a logarithmic scale, preferably in dB as that is the norm how Bode plots are made. And for good reason as it immediately tells you what order the filter is and where the cutoff point are.

• Thanks for the explanation and somethings just clicked in my head for the difference between the two! As far as I can tell the Sallen-Key filter is doing the job at a -6dB crossover point, but when I try get a total output there becomes a massive gain boost at the crossover frequency. The link for the plot is below. Apologies I just can't seem to get this through my head; I thought that if they crossover at this point then the combination of the both of them should provide uniform gain. drive.google.com/open?id=0B9P3E06jd7WSbE9YdGVMbnczbkk – RogueAngel Apr 10 '17 at 23:09