代码:

% Analog Signal
Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signal
Ts = 0.0002; n = -25:1:25; x = exp(-1000*abs(n*Ts)); % Discrete-time Fourier Transform
%Wmax = 2*pi*2000;
K = 500; k = 0:1:K; w = pi*k/K; % index array k for frequencies
X = x * exp(-j*n'*w); magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X);
%% --------------------------------------------------------------------
%% START X's mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Example3.19a X its mag ang real imag');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magX); grid on; %axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |X|');
subplot(2,2,3); plot(w/pi, angX/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realX); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagX); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% ------------------------------------------------------------------- X = real(X); w = [-fliplr(w), w(2:K+1)]; % Omega from -Wmax to Wmax
X = [fliplr(X), X(2:K+1)]; % X over -Wmax to Wmax interval
%% --------------------------------------------------------------------
%%
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', '<<DSP MATLAB>> Example3.19a');
set(gcf,'Color','white');
subplot(2,1,1); plot(t*1000,xa); grid on; %axis([0,1,0,1.5]);
title('Discrete Signal');
xlabel('t in msec units.'); ylabel('x1(n)'); hold on;
stem(n*Ts*1000,x); gtext('Ts=0.2 msec'); hold off; subplot(2,1,2); plot(w/pi, X); grid on; % axis([-1,1,-1,1]);
title('Discrete-time Fourier Transform');
xlabel('frequency in \pi units'); ylabel('X1(w)'); %% -------------------------------------------------------------------
%%
%% -------------------------------------------------------------------

  运行结果:

b

代码:

% Analog Signal
Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signal
%Ts = 0.0002; n = -25:1:25; x = exp(-1000*abs(n*Ts));
Ts = 0.001; n = -5:1:5; x = exp(-1000*abs(n*Ts)); % Discrete-time Fourier Transform
%Wmax = 2*pi*2000;
K = 500; k = 0:1:K; w = pi*k/K; % index array k for frequencies
X = x * exp(-j*n'*w); magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X);
%% --------------------------------------------------------------------
%% START X's mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Example3.19b X its mag ang real imag');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magX); grid on; %axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |X|');
subplot(2,2,3); plot(w/pi, angX/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realX); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagX); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% ------------------------------------------------------------------- X = real(X); w = [-fliplr(w), w(2:K+1)]; % Omega from -Wmax to Wmax
X = [fliplr(X), X(2:K+1)]; % X over -Wmax to Wmax interval
%% --------------------------------------------------------------------
%%
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', '<<DSP MATLAB>> Example3.19b');
set(gcf,'Color','white');
subplot(2,1,1); plot(t*1000,xa); grid on; %axis([0,1,0,1.5]);
title('Discrete Signal');
xlabel('t in msec units.'); ylabel('x1(n)'); hold on;
stem(n*Ts*1000,x); gtext('Ts=0.1 msec'); hold off; subplot(2,1,2); plot(w/pi, X); grid on; % axis([-1,1,-1,1]);
title('Discrete-time Fourier Transform');
xlabel('frequency in \pi units'); ylabel('X1(w)'); %% -------------------------------------------------------------------
%%
%% -------------------------------------------------------------------

  运行结果:

DSP using MATLAB 示例 Example3.19的更多相关文章

  1. DSP using MATLAB 示例Example3.21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  2. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  3. DSP using MATLAB 示例Example3.23

    代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...

  4. DSP using MATLAB示例Example3.16

    代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...

  5. DSP using MATLAB 示例Example3.22

    代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...

  6. DSP using MATLAB 示例Example3.17

  7. DSP using MATLAB 示例 Example3.15

    上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...

  8. DSP using MATLAB 示例 Example3.13

    上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...

  9. DSP using MATLAB 示例 Example3.12

    用到的性质 代码: n = -5:10; x = sin(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , ...

随机推荐

  1. Volley与XUtils网络请求使用对比,心得,两者基本使用

    之前一直使用的Volley作为网络请求框架,它是Google 在2013年的I/O大会 上,发布的.Volley是Android平台上的网络通信库,能使网络通信更快,更简单,更健壮,同时扩展性很强.在 ...

  2. Hibernate双向一对一对象关系模型映射

    一个员工一辆车:one-to-one 实现一:让汽车表中的外键唯一 create table emp ( eid int primary key auto_increment, ename varch ...

  3. 在程序中使用geos.dll

    1 在项目->property->configuration properties->c/c++->general->additional include directo ...

  4. 搞笑世界杯(codevs 1060)

    题目描述 Description 随着世界杯小组赛的结束,法国,阿根廷等世界强队都纷纷被淘汰,让人心痛不已. 于是有 人组织了一场搞笑世界杯,将这些被淘汰的强队重新组织起来和世界杯一同比赛.你和你的朋 ...

  5. Android接口传递Json数组的处理方式

    public static XTResult<Void> addTravel(String uuid, String travelName, String travelId, String ...

  6. 磁盘空间占满inode结点没用完 并删除了文件但是释放不了

    lsof  |grep delete lsof(list system open file )可显示系统打开的文件,以root身份运行. 很多时候文件正在被占用,即使删除了,也无法释放空间,只有停 了 ...

  7. MVC学习笔记---各种上下文context

    0  前言 AspNet MVC中比较重要的上下文,有如下: 核心的上下文有HttpContext(请求上下文),ControllerContext(控制器上下文) 过滤器有关有五个的上下文Actio ...

  8. 理解Java中的final和static关键字

    回顾这两个关键字前,先考虑一个问题: Static变量存储在JVM中的位置,或者说static变量是如何被加载的? JVM会把类的静态方法和静态变量在类加载的过程中读入方法区(Method Area) ...

  9. 【JAVA IO流之字符流】

    一.概述. java对数据的操作是通过流的方式.java用于操作流的对象都在IO包中.流按照操作数据不同分为两种,字节流和字符流.流按照流向分为输入流,输出流. 输入输出的“入”和“出”是相当于内存来 ...

  10. 以16进制打印出一块内存buff

    如下代码(支持windows与Linux)会以[16进制][每行16字节]打印出一块内存的内容: void PrintBuffer(void* pBuff, unsigned int nLen) { ...