%设置参量,采用4倍采样速率,滚降系数为0.5
Fd=1; Fs=4; Delay=2; R=0.5;
%建立升余弦滚降滤波器
[yf,tf]=rcosine(Fd,Fs,'sqrt',R,Delay);
%画图得到升余弦滚降滤波器波形
%b1=ones(1,length(t2));% 滤波器输入矩形脉冲
figure(1);
subplot(3,1,1);
plot(yf);
grid;
xlabel('Time');
ylabel('Amplitude');
title('平方根升余弦滚降滤波器h(t)');
%定义一个与二元序列对应的时间序列作为原始信号
x=[zeros(1,10),ones(1,10),ones(1,10),zeros(1,10),zeros(1,10),zeros(1,10)];
y1=filter(yf,tf,x)/(Fs^0.5);
%y2=filter(yf,tf,y1)/(Fs^0.5);
%画出原始信号波形
subplot(3,1,2);
plot(x);
axis([0,61,-0.2,1.2]);
title('原始信号');
%画出原始信号通过升余弦滚降滤波器后的输出
subplot(3,1,3);
plot(y1);
axis([2,61,-0.2,1.2]);
title('滤波后输出')
grid;
% subplot(4,1,4);
% plot(y2);
% axis([2,61,-0.2,1.2]);
% title('接收滤波器滤波后输出')
% grid;