📄 ip_06_07.m
字号:
% MATLAB script for Illustrative Problem 6.7.
close all
clear all
echo on
N=31;
T=1;
alpha=1/4;
n=-(N-1)/2:(N-1)/2; % the indices for g_T
% The expression for g_T is obtained next.
for i=1:length(n),
g_T(i)=0;
for m=-(N-1)/2:(N-1)/2,
g_T(i)=g_T(i)+sqrt(xrc(4*m/(N*T),alpha,T))*exp(j*2*pi*m*n(i)/N);
echo off ;
end;
end;
echo on ;
g_T=real(g_T) ; % The imaginary part is due to the finite machine precision
% Derive g_T(n-(N-1)/2).
n2=0:N-1;
figure(1)
stem(n2,g_T)
hgsave('fig_ip0607_1')
[G_T,W]=freqz(g_T,1); % Get the frequency response characteristics.
magG_T_in_dB=20*log10(abs(G_T)/max(abs(G_T))); % normalized magnitude response
figure(2);
plot(W/(2*pi),magG_T_in_dB);
% impulse response of the cascade of the transmitter and the receiver filters
g_R=g_T;
imp_resp_of_cascade=conv(g_R,g_T);
hgsave('fig_ip0607_2')
figure(3);
%plot(zeros(size([0:2*N-1])));
hold;
stem([1:2*N-1],imp_resp_of_cascade);
hgsave('fig_ip0607_3')
% Plotting commands follow.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -