《DSP using MATLAB》 Problem 2.3
本题主要是显示周期序列的。
1、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.1 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ %%
%% {...,-2,-1,0,1,2,...}
%% *
%% Plot 5 periods
self_length = 5;
periods = 5; n = [-2:(2+(periods-1) * self_length)];x = [-2,-1,0,1,2];
xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.1');
set(gcf,'Color','white');
stem(n,xtilde); title('Sequence in Problem 2.3.1');
xlabel('n'); ylabel('xtilde(n)');grid on;
显示结果:
2、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.2 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ %%
%% exp(0.1n)[ u(n) - u(n-20)] 0-20 valid
%%
%% Plot 3 periods [0;3*20-1] [0,59] n = [0:20]; % We can get self_periods=21 from here
x = exp(0.1*n) .* (stepseq(0,0,20) - stepseq(20,0,20));
%x = (stepseq(0,0,20) - stepseq(20,0,20)); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.2 x(n)');
set(gcf,'Color','white');
stem(n,x); title('x(n) Sequence');
xlabel('n'); ylabel('x(n)');grid on; self_length = 21;
periods = 3;
n1 = [0:20 + (periods-1) * self_length]; xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.2');
set(gcf,'Color','white');
stem(n1,xtilde); title('Sequence in Problem 2.3.2');
xlabel('n'); ylabel('xtilde(n)');grid on;
运行结果:
3、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.3 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ %%
%% sin(0.1*pi*n)[ u(n) - u(n-10)] 0-10 valid
%%
%% Plot 4 periods n = [0:10]; % We can get self_periods=11 from here
x = sin(0.1*pi*n) .* (stepseq(0,0,10) - stepseq(10,0,10)); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.3 x(n)');
set(gcf,'Color','white');
stem(n,x); title('x(n) Sequence');
xlabel('n'); ylabel('x(n)');grid on; self_length = 11;
periods = 4;
n1 = [0:10 + (periods-1) * self_length]; xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.3');
set(gcf,'Color','white');
stem(n1,xtilde); title('Sequence in Problem 2.3.3');
xlabel('n'); ylabel('xtilde(n)');grid on;
运行结果:
4、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.4 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ %%
%% {...,1,2,3,...} + {...,1,2,3,4,...} n=[0:24]
%% * *
%% what is the periods self_length1 = 3;
periods1 = 8; n1 = [0:(2+(periods1-1) * self_length1)];
x1 = [1, 2, 3];
xtilde1 = x1' * ones(1,periods1); xtilde1 = (xtilde1(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4 Period Seq 1');
set(gcf,'Color','white');
stem(n1,xtilde1); title('Sequence {...,1,2,3,...}');
xlabel('n'); ylabel('xtilde1(n)');grid on; self_length2 = 4;
periods2 = 6; n2 = [0:(3+(periods2-1) * self_length2)];
x2 = [1, 2, 3, 4];
xtilde2 = x2' * ones(1,periods2); xtilde2 = (xtilde2(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4 Period Seq 2');
set(gcf,'Color','white');
stem(n2,xtilde2); title('Sequence {...,1,2,3,4,...}');
xlabel('n'); ylabel('xtilde2(n)');grid on; x = xtilde1 + xtilde2
%[x,n] = sigadd(xtilde1,24,xtilde2,24); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4');
set(gcf,'Color','white');
stem(x); title('Sequence {...,1,2,3,...} + {...,1,2,3,4,...}');
xlabel('n'); ylabel('x(n)');grid on;
运行结果:
《DSP using MATLAB》 Problem 2.3的更多相关文章
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.14
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.13
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- flask应用中取得config的配置
from flask import current_app config = current_app.config SITE_DOMAIN = config.get('SITE_DOMAIN')
- ubuntu18.04下挂载网络文件系统失败【学习笔记】
作者:庄泽彬(欢迎转载,请注明作者) PC: ubuntu18.04 说明: 之前ubuntu16.04下搭建的环境,开发板挂载网络文件系统是ok的,但是换到ubuntu18.04在启动的时候 ...
- git clone时提示(gnome-ssh-askpass:29288): Gtk-WARNING **: cannot open display:
一.背景 在服务器上克隆源码 二.解决 unset SSH_ASKPSS
- The current .NET SDK does not support targeting .NET Core 3.0
编译错误 Severity Code Description Project File Line Suppression StateError NETSDK1045 The current .NET ...
- git commit的规范
https://www.yuque.com/fe9/basic/nruxq8#6c228def 制定一个 git commit 信息的提交规范是开发团队工作流必不可少的环节.试想一下,如果查看主分支上 ...
- vue-Treeselect实现组织机构(员工)下拉树的功能
知识点:前端使用vuetree的组件库,调用后台查询组织机构,包括人员的接口 实现下拉树的功能 查考: vue-treeselect官网:https://vue-treeselect.js.org/ ...
- POJ 1815 Friendship(最小割+字典序输出割点)
http://poj.org/problem?id=1815 题意: 在现代社会,每个人都有自己的朋友.由于每个人都很忙,他们只通过电话联系.你可以假定A可以和B保持联系,当且仅当:①A知道B的电话号 ...
- arcgis api for silverlight开发系列之二:缓存图层与动态图层及图层总结 .
本文摘自:http://blog.csdn.net/leesmn/article/details/6916458(很优秀的博客) 作为ESRI的平台的一份子arcgis api for silve ...
- css3伪放大镜(图片放大动画)效果(鼠标移入圆形区域放大图片)
源码: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&q ...
- charles抓取https中出现unknow
http正常抓包,https则出现unknown 1.安装证书 Help->SSL Proxying->Install Charles Root Certificate 但是!!!装完并没 ...