《DSP using MATLAB》Problem 2.8
1、代码:
从MATLAB官方网上下载的。
%*************************************************************************%
%A code for the Downsampler%
%Author: Yashwant Marathe%
%Date:20-12-2010%
function [y ny] = dnsample(x,n,M)
%x is a sequence over indices specified by vector n,M is the downsampling factor. param=n/M;
%generates the parameter vector.This vector will decide which input samples will be present in the output. samp=fix(param)==param;
%only those output vectors corresponding to indices where samp==1 will be present in the output. y=x(samp==1);
%generates the output sequence ny=n(samp==1)/M;
%generates the indices of the output sequence end
%**************************************************************************
2、代码
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.8.2 \n\n'); banner();
%% ------------------------------------------------------------------------ n = [-50:1:50];
x = sin( 0.125 * pi * n ); M = 4; [y, m] = dnsample(x, n, M); figure('NumberTitle', 'off', 'Name', 'Problem 2.8.2')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n, x); title('x sequence');
xlabel('n'); ylabel('x(n)') ;
grid on
subplot(2,1,2); stem(m, y); title('y sequence');
xlabel('n'); ylabel('y(m)');
grid on;
运行结果:
3、代码
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.8.3 \n\n'); banner();
%% ------------------------------------------------------------------------ n = [-50:1:50];
x = sin( 0.5 * pi * n ); M = 4; [y, m] = dnsample(x, n, M); figure('NumberTitle', 'off', 'Name', 'Problem 2.8.3')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n, x); title('x sequence');
xlabel('n'); ylabel('x(n)') ;
grid on
subplot(2,1,2); stem(m, y); title('y sequence');
xlabel('n'); ylabel('y(m)');
grid on;
运行结果:
《DSP using MATLAB》Problem 2.8的更多相关文章
- 《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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- Java基础教程:注解
Java基础教程:注解 本篇文章参考的相关资料链接: 维基百科:https://zh.wikipedia.org/wiki/Java%E6%B3%A8%E8%A7%A3 注解基础与高级应用:http: ...
- 一次org.springframework.jdbc.BadSqlGrammarException ### Error querying database Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException问题排查过程
先说结论: 因为在表设计中有一个商品描述字段被设置为desc,但desc是mysql中的关键字,如select id,name,desc,price from product;这条sql语句在查询时的 ...
- Learn2Rank
Learning to rank 排序学习是推荐.搜索.广告的核心方法.排序结果的好坏很大程度影响用户体验.广告收入等.排序学习可以理解为机器学习中用户排序的方法,这里首先推荐一本微软亚洲研究院刘铁岩 ...
- 【4】Python对象
本章主题 Python对象 内建类型 标准类型操作符 值的比较 对象身份比较 布尔类型 标准类型内建函数 标准类型总览 各种类型 不支持的类型 Python对象 Python使用 ...
- Android SurfaceView入门学习
学习资料: Android 开发群英传 搜索学习资料时,搜到了罗升阳老师的Android视图SurfaceView的实现原理分析,老罗老师写的一系列博客,一年前开始学习Android时看不懂,现在依然 ...
- HDU1978How Many Ways 记忆化dfs+dp
/*记忆化dfs+dp dp[i][j]代表达到这个点的所有路的条数,那么所有到达终点的路的总数就是这dp[1][1]加上所有他所能到达的点的 所有路的总数 */ #include<stdio. ...
- 20145336张子扬 《网络对抗》逆向及bof基础
20145336张子扬 <网络对抗>逆向及bof基础 学习知识点 缓冲区溢出 缓冲区溢出 一种非常普遍.非常危险的漏洞,在各种操作系统.应用软件中广泛存在.利用缓冲区溢出攻击,可以导致程序 ...
- linux及安全第七周总结——20135227黄晓妍
实验部分 首先clone最新的menu 我们可以看到,test.c里多了一个exec的功能,它的代码和fork基本一致,多了一项加载hello rootfs也有一些变化 执行一下exec 让我们启动一 ...
- 20155201 实验一《Java开发环境的熟悉》实验报告
20155201 实验一<Java开发环境的熟悉>实验报告 一.实验内容 1.使用JDK编译.运行简单的Java程序 2.使用IDEA 编辑.编译.运行.调试Java程序. 二.练习 题目 ...
- Qt+json
Json文件是这样: { "first fruit": { "describe":"an apple", "icon": ...