概述
成形滤波器的设计(FDATOOL)
- 1 滤波器的设计
- 1.1 成形滤波器
- 1.1.1 为什么要脉冲成形
- 1.1.2 成形滤波器 的设计
- 1.2 低通滤波器
- 2 例程
- 2.1 原代码
- 2.2 仿真结果
- 3 成形滤波后所带来的问题
- 4 知识点补充
1 滤波器的设计
1.1 成形滤波器
1.1.1 为什么要脉冲成形
(1)频谱压缩,限制信号带宽
在数字通信中基带信号是矩形脉冲,突变的上升沿和下降沿包含高频分量丰富,其频谱范围普遍比较宽(频谱是一个Sa函数)。为了有效利用信道,在信号传输之前,需要对信号进行频谱压缩。使其在消除码间串扰和达到最佳检测的前提下,大大提高频带利用率。信号带宽匹配信道带宽。
(2)降低码间干扰,提高传输可靠性
改变传输信号的成形波形,可以减小抽样定时脉冲误差所带来的影响,即降低了码间干扰(ISI)。信号带限就会引入码间串扰,会导致接收信号波形失真。但一般情况下,只需要在特定时刻的信号抽样值无失真,并不需要整个信号波形都无失真,而升余弦滤波器刚好就能对基带信号频谱进行带限,并且不影响信号在特定时刻的抽值。
通过引入滚降系数,改变传输信号的成型波形。从而降低抽样定时脉冲误差所带来的影响,即降低了码间干扰(ISI),提高了传输的可靠性。
1.1.2 成形滤波器 的设计
成形滤波器的设计推荐用FDATOOL,而不建议使用函数。
Response Type:Raised-cosine
Filter order:指定滤波器的阶数
Fs:信号的采样频率
Fc:截止频率,其值为码速率RB的一半。
Rolloff:滚降系数,一般选择0.35。
Normal:升余弦滤波器。
square root:根升余弦滤波器。
function Hd = Shaping_filter
%SHAPING_FILTER Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and DSP System Toolbox 9.7.
% Generated on: 13-Dec-2021 12:17:17
% FIR Window Raised-cosine filter designed using the FIRRCOS function.
% All frequency values are in MHz.
Fs = 100; % Sampling Frequency
N = 200; % Order
Fc = 0.5; % Cutoff Frequency
TM = 'Rolloff'; % Transition Mode
R = 0.35; % Rolloff
DT = 'Normal'; % Design Type
Beta = 0.5; % Window Parameter
% Create the window vector for the design algorithm.
win = kaiser(N+1, Beta);
% Calculate the coefficients using the FIR1 function.
b = firrcos(N, Fc/(Fs/2), R, 2, TM, DT, [], win);
Hd = dfilt.dffir(b);
% [EOF]
1.2 低通滤波器
对于基带信号s(t)而言,信号带宽等于码速率RB。现在将基带信号进行调制和解调(没有加成形滤波器),得到的表达式为s(t)cos(2pifct)cos(2pifct)。从表达式可以看出,为了恢复基带信号,需要滤掉2fc分量。那么如何设计该低通滤波器呢。利用matlab的fdatool工具。如下图所示,
通带频率Fpass:一般为码速率RB,为了留点余量,稍微大于码速率。其中,程序中设置的码速率RB=1MHz。
截止频率Fstop:为2fc-RB,同时也要留点余量。
function Hd = low_pass
%LOW_PASS Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and DSP System Toolbox 9.7.
% Generated on: 13-Dec-2021 12:20:45
% Equiripple Lowpass filter designed using the FIRPM function.
% All frequency values are in MHz.
Fs = 100; % Sampling Frequency
N = 50; % Order
Fpass = 2; % Passband Frequency
Fstop = 18; % Stopband Frequency
Wpass = 1; % Passband Weight
Wstop = 1; % Stopband Weight
dens = 20; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fpass Fstop Fs/2]/(Fs/2), [1 1 0 0], [Wpass Wstop], ...
{dens});
Hd = dfilt.dffir(b);
% [EOF]
2 例程
2.1 原代码
%%%%%%%%%%%%%%%%%% 成形滤波器的设计与应用 %%%%%%%%%%%%%%%%%%%%%%
%%%% 仿真步骤
% 1、产生基带信号-1 1 2、成形滤波器的设计
% 3、对基带信号成形,画出信号波形 4、成形滤波后的信号进行BPSK调制
% 5、相干解调 6、对解调后的信号进行低通滤波、成形滤波(可选)
% 7、抽样判决
clc;
clear all;
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 参数设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=20; % 码元个数
fc=10e6; % 载波信号频率
Fs =10*fc; % 采样频率
RB=1e6; % 码速率
count=Fs/RB; % 每个码元的采样点数
n=N*count; % 总的采样点数
ts=1/Fs; % 最小采样间隔
Ts=1/Fs*count; % 码元周期
t1=(1:N)*Ts; % 码元持续时间
t2=(1:n)*ts; % 总的持续时间
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 产生基带信号
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=randi([0 1],1,N)*2-1; % 产生双极性序列 1 -1
figure(1);
subplot(211);
stem(t1,x);grid on;
ylim([-1.2 1.2]);
% 将x的值插入到xt中,每count个插一个
for p=1:N
xt(( (p-1)*count+1):( p*count) ) = x(p);
end
subplot(212);
plot(t2,xt);grid on;
ylim([-1.2 1.2]);
title('基带信号时域波形');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 成型滤波的产生
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 成形滤波器的设计推荐用FDATOOL,而不建议使用函数。
% Response Type:Raised-cosine
% Filter order:指定滤波器的阶数
% Fs:信号的采样频率
% Fc:截止频率,其值为码速率RB的一半。
% Rolloff:滚降系数,一般选择0.35。
% Normal:升余弦滤波器。
% square root:根升余弦滤波器。
%SHAPING_FILTER Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and DSP System Toolbox 9.7.
% Generated on: 13-Dec-2021 12:17:17
% FIR Window Raised-cosine filter designed using the FIRRCOS function.
% All frequency values are in MHz.
Fs = 100; % Sampling Frequency
N = 200; % Order
Fc = 0.5; % Cutoff Frequency
TM = 'Rolloff'; % Transition Mode
R = 0.35; % Rolloff
DT = 'Normal'; % Design Type
Beta = 0.5; % Window Parameter
% Create the window vector for the design algorithm.
win = kaiser(N+1, Beta);
% Calculate the coefficients using the FIR1 function.
yf = firrcos(N, Fc/(Fs/2), R, 2, TM, DT, [], win);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 对基带信号成型,画出信号波形
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y1=conv(yf,xt);
y1=y1((length(yf)-1)/2+1:end-(length(yf)-1)/2); % 去掉滤波器的延时
figure(3);
plot(t2,y1); grid on;
legend('基带信号成形滤波后的信号时域波形');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BPSK调制
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y_carry=cos(2*pi*fc*t2);
y_bpsk=y1.*y_carry; % 调制
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 相干解调
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y_jietiao=y_bpsk.*y_carry; % 相干解调
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 低通滤波
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%LOW_PASS Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and DSP System Toolbox 9.7.
% Generated on: 13-Dec-2021 12:20:45
% Equiripple Lowpass filter designed using the FIRPM function.
% All frequency values are in MHz.
Fs = 100; % Sampling Frequency
N = 50; % Order
Fpass = 2; % Passband Frequency
Fstop = 18; % Stopband Frequency
Wpass = 1; % Passband Weight
Wstop = 1; % Stopband Weight
dens = 20; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fpass Fstop Fs/2]/(Fs/2), [1 1 0 0], [Wpass Wstop], ...
{dens});
%-------------低通滤波
y_jietiao_lowpass=conv(b,y_jietiao);
y_jietiao_lowpass=y_jietiao_lowpass((length(b)-1)/2+1:end-(length(b)-1)/2);% 去掉滤波器的延时
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 抽样
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y_end=y_jietiao_lowpass((count/2+1):count:end); % 抽样
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 判决
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:length(y_end)
if y_end(i)>=0
y_end(i)=1;
else
y_end(i)=-1;
end
end
figure(4)
stem(y_end,'-k*');hold on;
stem(x,'-ro'); hold on;grid on;
legend('最后输出序列','基带序列');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 误码数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
error=0;
for i=1:length(y_end)
if ( y_end(i)~=x(i))
error=error+1;
end
end
fprintf('错误的码元个数为%gn',error);
%%%%%%%%%%%%%%%%%%%%%%%%%% 结论 %%%%%%%%%%%%%%%%%%%%%%%%%
% 1、成型滤波的设计:滤波器的参数要根据系统参数来设定(码元速率、采样率)
% 对基带信号进行成型滤波时,首先要内插 ,目的在于使成型滤波基带信号平滑
% 插入0的个数取决于一个码元采集了多少个样点
% 判断成型滤波器是否合适:滤波后信号是否平滑 基带信号的数据点是否在滤波后的波形上(见figure3)
2.2 仿真结果
错误的码元个数为0
3 成形滤波后所带来的问题
因为基带信号经过成形滤波后,信号包络不再恒定。此时经过非线性放大器后,会导致频谱展宽,从而降低了频带利用率。
具体解释过程:
总结:
4 知识点补充
成形滤波
最后
以上就是魁梧草莓为你收集整理的成形滤波器(利用FDATOOL设计成形滤波器)1 滤波器的设计2 例程3 成形滤波后所带来的问题4 知识点补充的全部内容,希望文章能够帮你解决成形滤波器(利用FDATOOL设计成形滤波器)1 滤波器的设计2 例程3 成形滤波后所带来的问题4 知识点补充所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复