Main Content

带通滤波器响应

This example shows how to compute the time-domain response of a simple bandpass filter. The eight steps involved in computing the time-domain response of a simple bandpass filter are,

  1. 使用classic image parameter design to assign inductance and capacitance values to the bandpass filter.

  2. 使用circuit,,,,capacitor,,,,and电感器objects with the添加功能以编程方式构建Butterworth电路。

  3. 使用setports功能以将电路定义为2端口网络。

  4. 使用Sparametersfunction to extract the S-parameters of the 2-port network over a wide frequency range.

  5. 使用S2TF功能以计算从输入到输出的电压传输函数。

  6. 使用合理的object to generate rational fits that capture the ideal RC circuit to a very high degree of accuracy.

  7. 使用兰德function to create noise in order to create a noisy input voltage waveform.

  8. 使用计时器function要计算对嘈杂输入电压波形的瞬态响应。

Design Bandpass Filter Using Image Parameters

图像参数设计是用于分析计算被动过滤器中串联和并行组件的值的框架。有关图像参数的更多信息,请参见Cotter W. Sayre的“完整无线设计”,McGraw-Hill 2008 p。331。

图1:Butterworth带通滤波器由两个半部分构建。

生成较低3 dB截止频率为2.4 GHz的带通滤波器的组件值,并且上3 dB截止频率为2.5 GHz。

Ro = 50; f1C = 2400e6; f2C = 2500e6; Ls = (Ro / (pi*(f2C - f1C)))/2;%LS1和LS2CS = 2*(F2C -F1C)/(4*Pi*ro*f2c*f1c);% Cs1 and Cs2lp = 2*ro*(f2c -f1c)/(4*pi*f2c*f1c);%LP1and Lp2Cp =(1 /(π* Ro * (f2C - f1C))) / 2;%cp1and Cp2

编程构建电路

在使用构建电路之前电感器andcapacitorobjects, nodes in the circuit are numbered. This is shown in figure 1.

图2:节点编号添加到Butterworth带通滤波器中。

创建一个circuit对象并用电感器capacitorobjects using the添加功能。

ckt =电路('Butterworthbpf');添加(CKT,[3 2],电感器(LS));%ls1添加(ckt,[4 3],capacitor(Cs));% Cs1添加(ckt,[5 4],capacitor(Cs));% Cs2添加(ckt,[6 5],inductor(Ls));%ls2添加(CKT,[4 1],电容器(CP));%cp1添加(ckt,[4 1],inductor(Lp));%LP1添加(ckt,[4 1],inductor(Lp));%lp2添加(CKT,[4 1],电容器(CP));%CP2

Extract S-Parameters From 2-Port Network

To extract S-parameters from the circuit object, first use thesetports功能以将电路定义为2端口网络。

freq = linspace(2e9,3e9,101);

使用Sparameters功能以在感兴趣的频率下提取S-参数。

setports(ckt,[2 1],[6 1]) S = sparameters(ckt,freq);

拟合电路转移到理性函数

使用S2TF功能以从S-参数对象生成传输函数。

tfS = s2tf(S);

使用合理的object to fit the transfer function data to a rational function.

fit = Rational(Freq,TFS);

Verify Rational Fit Approximation

使用freqrespfunction to verify that the rational fit approximation has reasonable behavior outside both sides of the fitted frequency range.

widerfreqs = linspace(2e8,5e9,1001);RESS = freqresp(fit,widerfreqs);

图可视化理性拟合近似。理性拟合表现良好,超出了拟合频率范围。

图半学(FREQ,ABS(TFS),WIDERFREQS,ABS(RESS),'--',,,,“线宽”,2)Xlabel(“频率(Hz)”);ylabel('震级');legend('data',,,,'合身');标题('Rational Fit Approximation');

图包含一个轴对象。带有标题有理拟合近似值的轴对象包含2个类型线的对象。这些对象表示数据,适合。

Construct Input Signal to Test Bandpass Filter

为了测试由图像参数技术设计的带通滤波器,从嘈杂的输入信号中回收了2.45 GHz的正弦信号。噪声输入信号是通过将零均值随机噪声和2.35 GHz的阻滞剂纳入输入信号而产生的。

Construct a input and a noisy input signal with 8192 samples.

fcenter = 2.45e9;fblocker = 2.35e9;周期= 1/fcenter;sampletime = ofient/16;Signallen = 8192;t =(0:signallen-1)'*sampletime;% 256 periods输入= sin(2*pi*fcenter*t);%干净输入信号rng('default') noise = randn(size(t)) + sin(2*pi*fBlocker*t); noisyInput = input + noise;% Noisy input signal

Compute Transient Response to Input Signal

使用计时器function to compute the analytic solutions of the state-space.

output = timeresp(fit,noisyInput,sampleTime);

在时域查看输入信号和过滤器响应

Plot the input signal, noisy input signal, and the band pass filter output in a figure window.

xmax = t(end)/8;图子图(3,1,1)图(t,输入)轴([0 xmax -1.5 1.5])标题('Input')子图(3,1,2)图(t,noisyInput)轴([0 Xmax落地(min(noisyInput))CEIL(max(noisyInput))]);标题('Noisy Input');ylabel(“振幅(伏特)”);子图(3,1,3)图(t,输出)轴([0 xmax -1.5 1.5]);标题(“过滤输出”);Xlabel('Time (sec)');

Figure contains 3 axes objects. Axes object 1 with title Input contains an object of type line. Axes object 2 with title Noisy Input contains an object of type line. Axes object 3 with title Filter Output contains an object of type line.

View Input Signal and Filter Response in Frequency Domain

Overlaying the noisy input and the filter response in the frequency domain explains why the filtering operation is successful. Both the blocker signal at 2.35 GHz and much of the noise are significantly attenuated.

nfft = 2^nextPow2(signallen);y长度的2个下一个功率2的下一个功率y = fft(noisyInput,nfft)/signallen;SamplingFreq = 1/SampleTime;f = samplingfreq/2*linspace(0,1,nfft/2+1)';o = fft(输出,nfft)/signallen;图子图(2,1,1)图(FREQ,ABS(TFS),'b',,,,“线宽”,,,,2) axis([freq(1) freq(end) 0 1.1]); legend(“滤波器传输功能”);标题(“带通滤波器的传输函数”);ylabel('震级');subplot(2,1,2) plot(f,2*abs(Y(1:NFFT/2+1)),‘g’,f,2*abs(o(1:nfft/2+1)),'r',,,,“线宽”,,,,2) axis([freq(1) freq(end) 0 1.1]); legend(“输入+噪声”,,,,'输出');标题('Filter characteristic and noisy input spectrum.');Xlabel(“频率(Hz)”);ylabel('Magnitude (Volts)');

图包含2个轴对象。带有带通滤波器标题传输功能的轴对象1包含类型线的对象。该对象表示过滤器传输函数。轴对象2具有标题过滤器特性和嘈杂的输入频谱。包含2个类型行的对象。这些对象表示输入+噪声,输出。

要使用RFCKT对象计算和显示此带通滤波器响应,请参见使用RFCKT对象的带通滤波器响应

Related Topics