信号的采样和奇妙的混叠(Aliasing) 贰

混叠频率的计算

 

     上次我们讲到如果混叠没能成功避免,那么混叠后的信号就会偷偷混入重建后的信号。那么这个经过伪装的“伪装信号”的频率是多少呢?他会出现在频谱中的哪里呢?这是可以通过精确计算得到的。

     先从奥本海姆的信号与系统中的一幅插图说起,奥本海姆老师想要通过这幅图说明混叠,所绘制的波形为下图公式所示的余弦函数。

     图中的ωo表示原始信号的频率,ωs表示采样频率。这幅图一共有四张,前两张的采样频率分别是原始频率的6倍和3倍,所以重建后的信号并没有出现混叠如下图所示。

点击图像放大

由于我很喜欢这个例子,所以我就用matlab把它仿真了一下。此处我的余弦函数的采样频率为60Hz, 所以第一个连续信号(下图中第一行)的原始频率为10Hz, 此时采样频率为原始信号频率的6倍。第二个连续信号(下图中第三行)的原始频率为20Hz, 此时采样频率为原始信号频率的3倍。(箭头没能仿真成功,嘻嘻)

点击图像放大

Matlab代码如下:


  
  
  1. %CSDN:by J27 copyright!
  2. %% sampling freqency 6 times continous signal
  3. Fs = 60; % Sampling Freq.
  4. Fo = Fs/ 6; % freq. of continous Signal
  5. T = 1/Fs; % sampling period
  6. tmin = -pi/ 15.7; % lower limit of time vector
  7. tmax = pi/ 15.7; % upper limit of time vector
  8. Bins = 400; % Number of Bins
  9. t = linspace(tmin, tmax, Bins); % time space vector
  10. nmin = ceil(tmin / T); % lower limit of num vector
  11. nmax = floor(tmax / T); % upper limit of num vector
  12. n = nmin:nmax; % discrete space vector
  13. CosineSignal = cos( 2.*pi.*Fo.*t);
  14. SampleSignal = cos( 2.*pi.*Fo.*n.*T);
  15. subplot( 4, 1, 1)
  16. plot(t,CosineSignal, 'k', 'LineWidth', 2);
  17. title( '\fontsize{35}Sampling freqency 6 times continous signal. i.e. Proper sampling');
  18. hold on
  19. stem (n*T,SampleSignal,'r','filled','LineWidth',2)
  20. hold off
  21. subplot (4,1,2)
  22. plot (t,CosineSignal,'--k','LineWidth',2);
  23. title( '\fontsize{35}Rebuild continous signal with sampled discrete signal');
  24. hold on
  25. stem(n*T,SampleSignal,'r','filled','LineWidth',2)
  26. hold off
  27. %% sampling freqency 3 times continous signal
  28. Fs = 60; % Sampling Freq.
  29. Fo = Fs/ 3; % freq. of continous Signal
  30. T = 1/Fs; % sampling period
  31. tmin = -pi/ 15.7; % lower limit of time vector
  32. tmax = pi/ 15.7; % upper limit of time vector
  33. Bins = 400; % Number of Bins
  34. t = linspace(tmin, tmax, Bins); % time space vector
  35. nmin = ceil(tmin / T); % lower limit of num vector
  36. nmax = floor(tmax / T); % upper limit of num vector
  37. n = nmin:nmax; % discrete space vector
  38. CosineSignal = cos( 2.*pi.*Fo.*t);
  39. SampleSignal = cos( 2.*pi.*Fo.*n.*T);
  40. subplot( 4, 1, 3)
  41. plot(t,CosineSignal, 'k', 'LineWidth', 2);
  42. title( '\fontsize{35}Sampling freqency 3 times continous signal. i.e. Proper sampling');
  43. hold on
  44. stem (n*T,SampleSignal,'r','filled','LineWidth',2)
  45. hold off
  46. subplot (4,1,4)
  47. plot (t,CosineSignal,'--k','LineWidth',2);
  48. title( '\fontsize{35}Rebuild continous signal with sampled discrete signal');
  49. hold on
  50. stem (n*T,SampleSignal,'r','filled','LineWidth',2)
  51. hold off    

     在用matlab仿真时,重建信号(即图像中灰色虚线)的频率由于没有出现混叠。则在用matlab绘制图像时,重建的COS波形的频率沿用了原始信号的频率Fo。但在仿真下面图像时就必须要精确的计算出混叠后的频率Fs才能绘制出混叠信号的波形。

 

点击图像放大

     要想画出上图中的虚线,即伪装后变慢了的信号,必须要精确的知道信号变慢了多少。对于欠采样不太严重的情况(即,原始频率小于采样频率但大于采样频率的一半。Fs/2<Fo<Fs),如上图中的情况。则可以使用如下计算公式中的情形(c)和情形(d):

在本例中我所使用的采样频率为60Hz, 按照公式(c)和公式(d)则发生混叠后的混叠频率分别为:

                                                        For   (c)    ωo = 40Hz ;     Fa = ωs - ωo = 60 - 40 = 20Hz

                                                        For   (d)    ωo = 50Hz ;     Fa = ωs - ωo = 60 - 50 = 10Hz

 

     如果原始信号的频率远远高于采样频率,即原始频率Fo不仅大于Fs还有可能大于Fs的2,3,4,5...倍则可以使用如下公式。fa表示混叠频率,fs表示采样频率,f表示原始信号的最高频。式中||表示求绝对值,式中(closest integermultiple of fs)表示整数倍于最接近原始频率f的倍数。例如,如果采样频率为100Hz,原始信号的最高频为710Hz则这是式中的(closest integermultiple of fs)等于7,即7*fs。

   现假设信号采样频率为100 Hz,输入信号包含下列频率:25 Hz、70 Hz、160 Hz和510 Hz。 低于50 Hz奈奎斯特频率才可正确采样,超过50 Hz的频率显示为混叠,所以只有频率为25Hz的信号才能被正确采样。fs/2为奈奎斯特频率即采样频率的一半。

其中,频率超过50Hz的信号的混叠频率计算公式为:

(1) 当输入信号的频率F2为70Hz时,采样频率Fs为100Hz。按照奈奎斯特采样定律,要想对70Hz的输入信号充分采样,采样频率至少要大于140Hz,即输入信号频率的两倍。所以发生了混叠,由于输入频率为70,所以离采样频率100最近的整数倍数是1(即,这里的(closest integermultiple of fs) = 1)。  计算结果如下:     

                                                                                      F2 Alias = |100 - 70| = 30Hz

 

(2) 当输入信号的频率F3为160Hz时,采样频率为Fs100Hz。采样频率低于输入信号的频率,发生了混叠,由于输入频率为160,所以离采样频率100最近的整数倍数是2(即,这里的(closest integermultiple of fs) = 2)。  计算结果如下:     

                                                                                      F3 Alias = |2*100 - 160| = 40Hz

 

(3) 当输入信号的频率F4为510Hz时,采样频率为Fs100Hz。采样频率低于输入信号的频率,发生了混叠,由于输入频率为510,所以离采样频率100最近的整数倍数是5(即,这里的(closest integermultiple of fs) = 5)。  计算结果如下:     

                                                                                      F4 Alias = |5*100 - 510| = 10Hz

 

混叠频率即折叠频率:     

     混叠频率有时又叫折叠频率,只需把超过奈奎斯特频率(Fs/2)的频段或是超过采样频率(Fs)的频段以奈奎斯特频率或采样频率为中轴对折过去就好了。或者说是以奈奎斯特频率或采样频率为中轴的镜像。如下图,一个6Hz的信号以奈奎斯特频率3.5Hz为中轴折叠为1Hz的信号。同理,一个8Hz的信号以采样频率7Hz为中轴折叠为频率为6Hz的信号。

 

     好了, 计算公式以及详细的计算方法都已经给出来了。最后用Matlab把教科书中的带有混叠的那部分图示仿真出来(注意:重建后的混叠信号我用蓝色的虚线表示出来了)。

点击图像放大

Matlab代码:


  
  
  1. %CSDN:by J27 copyright!
  2. %% sampling freqency 3/ 2 times continous signal
  3. Fs = 60; % Sampling Freq.
  4. Fo = 4*Fs/ 6; % freq. of continous Signal
  5. T = 1/Fs; % sampling period
  6. tmin = -pi/ 15.7; % lower limit of time vector
  7. tmax = pi/ 15.7; % upper limit of time vector
  8. Bins = 400; % Number of Bins
  9. t = linspace(tmin, tmax, Bins); % time space vector
  10. nmin = ceil(tmin / T); % lower limit of num vector
  11. nmax = floor(tmax / T); % upper limit of num vector
  12. n = nmin:nmax; % discrete space vector
  13. CosineSignal = cos( 2.*pi.*Fo.*t);
  14. SampleSignal = cos( 2.*pi.*Fo.*n.*T);
  15. figure;
  16. subplot( 4, 1, 1)
  17. plot(t,CosineSignal, 'k', 'LineWidth', 2);
  18. title( '\fontsize{35}Sampling freqency 1.5 times continous signal. Improper sampling resualt in Aliasing');
  19. hold on
  20. stem(n*T,SampleSignal,'r','filled','LineWidth',2)
  21. hold off
  22. %figure out Aliasing freq.
  23. Fa = abs(Fo-Fs);
  24. CosineSignal = cos( 2.*pi.*Fa.*t);
  25. subplot( 4, 1, 2)
  26. plot(t,CosineSignal, '--b', 'LineWidth', 2);
  27. title( '\fontsize{35}Rebuild continous signal with sampled discrete signal');
  28. hold on
  29. stem(n*T,SampleSignal,'r','filled','LineWidth',2)
  30. hold off
  31. %% sampling freqency 6/5 times continous signal
  32. Fs = 60; % Sampling Freq.
  33. Fo = 5*Fs/ 6; % freq. of continous Signal
  34. T = 1/Fs; % sampling period
  35. tmin = -pi/ 15.7; % lower limit of time vector
  36. tmax = pi/ 15.7; % upper limit of time vector
  37. Bins = 400; % Number of Bins
  38. t = linspace(tmin, tmax, Bins); % time space vector
  39. nmin = ceil(tmin / T); % lower limit of num vector
  40. nmax = floor(tmax / T); % upper limit of num vector
  41. n = nmin:nmax; % discrete space vector
  42. CosineSignal = cos( 2.*pi.*Fo.*t);
  43. SampleSignal = cos( 2.*pi.*Fo.*n.*T);
  44. subplot( 4, 1, 3)
  45. plot(t,CosineSignal, 'k', 'LineWidth', 2);
  46. title( '\fontsize{35}Sampling freqency 1.2 times continous signal. Improper sampling resualt in Aliasing');
  47. hold on
  48. stem(n*T,SampleSignal,'r','filled','LineWidth',2)
  49. hold off
  50. % figure out Aliasing freq.
  51. Fa = abs(Fo-Fs);
  52. CosineSignal = cos( 2.*pi.*Fa.*t);
  53. subplot( 4, 1, 4)
  54. plot(t,CosineSignal, '--b', 'LineWidth', 2);
  55. title( '\fontsize{35}Rebuild continous signal with sampled discrete signal');
  56. hold on
  57. stem (n*T,SampleSignal,'r','filled','LineWidth',2)
  58. hold off

(全文完)

 

鸣谢:

【1】http://www.ni.com/white-paper/2709/zhs/  美国国家仪器(NI) 技术白皮书

【2】signals and systems 第二版 奥本海姆

【3】Matlab 2017a

【4】http://e2e.ti.com/blogs_/archives/b/precisionhub/archive/2015/09/04/aliasing-in-adcs-not-all-signals-are-what-they-appear-to-be  德州仪器

 

谢谢收看!

再见!

 

《圣经》马太福音3章2节  天国近了,你们应当悔改!

                                                                                        *配图与本文无关*

 

 

 

 

  • 2
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值