📄 pamsignalspectrumcalculation.m
字号:
% Calculation of PAM Signal Spectrum
echo on
T=1; % symbol duration
delta_T=T/200; % sampling interval
alpha=0.5; % roll-off factor
fc=40/T; % carrier frequency
A_m=1; % amplitude
t=-5*T+delta_T:delta_T:5*T; % time axis
N=length(t); % number of samples
for i=1:N, % calculation of raised cosine pulse
if (abs(t(i))~=T/(2*alpha)),
g_T(i)=sinc(t(i)/T)*(cos(pi*alpha*t(i)/T)/(1-4*alpha^2*t(i)^2/T^2));
else
g_T(i)=0; % the value of g_T is 0 at t=T/(2*alpha)
end; % and at t=T(2*alpha)
echo off;
end;
echo on;
G_T=abs(fft(g_T)); % spectrum of g_T
u_m=A_m*g_T.*cos(2*pi*fc*t);% the modulated signal
U_m=abs(fft(u_m)); % spectrum of the modulated signal
% actual frequency scale
f=-0.5/delta_T:1/(delta_T*(N-1)):0.5/delta_T;
% plotting commands follow
figure(1);
plot(f,fftshift(G_T));
axis([-1/T 1/T 0 max(G_T)]);
figure(2);
plot(t,g_T);
figure(3)
plot(f,fftshift(U_m));
figure(4);
plot(t,u_m);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -