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

📄 sam_frequency_sub.m

📁 很多matlab的源代码
💻 M
字号:
switch get(a2 ,'Value')
case 1 
   Fs=8000;
case 2
   Fs=5000;
case 3
   Fs=4000;
case 4
   Fs=3000;
case 5
   Fs=2000;
case 6
   Fs=1000;
end

% 模拟信号xa
Dt=0.00005;t=-0.005:Dt:0.005;xa=exp(-1000*abs(t));
subplot(2,1,1);
hh=plot(t*1000,xa,'r');
set(hh,'LineWidth',2);
xlabel('t in msec');
axis([-5,5,0,1.1])

% 模拟信号xa的频谱Xa
Fm=2000;
Wmax=2*pi*Fm;
K=500;k=0:1:K;W=k*Wmax/K;
Xa=xa*exp(-j*t'*W)*Dt;Xa=real(Xa);
W=[-fliplr(W),W(2:501)];               %频率从-Wmax到Wmax
Xa=[fliplr(Xa),Xa(2:501)];              %Xa介于-Wmax到Wmax之间
subplot(2,1,2);
hh=plot(W/(2*pi),Xa,'r');               %频率(-1到1,即-Wmax到Wmax)
axis([-4000,4000,0,max(Xa)*1.2])
set(hh,'LineWidth',2);
xlabel('f in Hz');

% 抽样信号
subplot(2,1,1);
Ts=1/Fs;n=-0.005/Ts:1:0.005/Ts;x = exp(-1000*abs(n*Ts));
hold on
hh=stem(n*Ts*1000,x);
set(hh,'LineWidth',2);
set(hh,'MarkerSize',2);
hold off
legend('Analog Signal','Discrete Signal')

f=-4000:10:4000;
w=f*2*pi/Fs;
X=x*exp(-j*n'*w);
X=real(X);
X=Ts*X;
subplot(2,1,2)
hold on
hh=plot(f,X);
set(hh,'LineWidth',2);
axis([-4000,4000,0,max(X)*1.2])
hold off
legend('Continuous-time Fourier Transform','Discrete-time Fourier Transform')

⌨️ 快捷键说明

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