⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sa2_3.m

📁 《Digital and Analog Communications Systems》(《数字和模拟通信系统》)的配套MATLAB源代码
💻 M
字号:
% File: SA2_3.M

clear;


T=10;
Tos=5;
f = -4:0.02:4;

% W(f) consists of both a continuous spectrum and a discrete spectrum.
% The computer cannot plot infinite values for the delta functions, 
% so plot the weights of the delta functions instead in 
% the magnitude spectrum.  The angle of the delta function dominates in 
% the phase spectrum at the frequency where the delta function occurs. 


% Continuous part -- Magnitude Spectrum
Wmag = zeros(length(f),1);
for (i=1:1:length(Wmag))
   Wmag(i) = T*abs(Sa(pi*f(i)*T)); 
end;

% Continuous part -- Phase spectrum
Theta = zeros(length(f),1);
for (i=1:1:length(Theta))
Theta(i)  = (180/pi)*(-2*pi*f(i)*Tos);   
end;

% Modify the Spectrum to include the Delta functions;
for (i = 1:1:length(f))
   if (f(i) == -3)
    Wmag(i) = 4;
    Theta(i)= 90;   
 end;
   if (f(i) == 3)
   Wmag(i) = 4;
   Theta(i)= -90;   
   end;   
 end;
 
 

subplot(211)
plot(f,Wmag);
xlabel('f, Hz-->');
ylabel('|W(f)|');
title('Magnitude Spectrum'); 

subplot(212)
plot(f,Theta);
xlabel('f, Hz-->');
ylabel('Theta(f), Degrees');
title('Phase Spectrum'); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -