📄 pr6_53.m
字号:
%Problem 6.53;
%SLSF for a binary sequence;
a=[-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1]; %input binary sequence;
N=length(a); t=[0:2*N]; %length of sequence;
subplot(211); stairs(t,[a,a,a(1)]); ylim([-1.2,1.2]); ylabel('s(t)'); xlabel('t/\Delta'); grid; xlim([0,2*N]); %plotting binary signal;
Ra=xcorr(a); R=Ra(N:2*N-1)+[0,Ra(1:N-1)]; R=[R,R,R(1)]/R(1); %sequence PACF;
Spa=fft(a); ISpa=1./Spa; %spectrum and its inversion;
b=ifft(ISpa); b=[b(1),b(N:-1:2)]; %filter coefficients;
Gm=norm(ISpa)^2;
Gmdb=10*log10(Gm);
R1=real(xcorr(a,b)); R1=R1(N:2*N-1)+[0,R1(1:N-1)]; R1=[R1,R1,R1(1)]/sqrt(Gm); %calculating SLSF response, real is taken to remove warning on dropping a negligible imaginary part;
subplot(212); plot(t,R,'b',t,R1,'r'); ylim([-0.4,1.2]); ylabel('s_{fltr}(t)'); xlabel('t/\Delta'); grid; xlim([0,2*N]); legend('MF','SLSF');%plotting periodic ACF of the signal;subplot(212); plot([0:2*N],R); ylim([-0.4,1.2]); ylabel('R(tau)'); xlabel('tau/delta'); grid; xlim([0,2*N]); %plotting periodic ACF of the signal;
disp(' N Rm Gm Gmdb');
disp([N,max(abs(R(2:N-1))),Gm,Gmdb]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -