当前位置:网站首页>MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数
MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数
2022-06-28 23:11:00 【Linest-5】
目录
upsample 和 downsample
upsample 和 downsample 顾名思义就是上采样和下采样,但是在 MATLAB 中代表的含义是什么,用 MATLAB 做个而简单的测验。
以下是 MATLAB 官方对两个函数的解释。


程序验证
上采样 upsample
首先定义一个 1×6 的矩阵 martix_A,并对其 4 倍上采样结果命名为 martix_B。
martix_A = [1 2 3 4 5 6]; martix_B = upsample(martix_A,4);
这是 martix_A 的数据格式

这是 martix_B 的数据格式,这里由于数据太长就没有截全

在工作区可以看出,矩阵 A 为 1×6 的矩阵,而矩阵 B 为 1×24 的矩阵,从上面的表格可以看出,upsample 的功能就是将矩阵中每个数据扩展 4 倍,剩余的 3 个数用 0 填充。

在从具体的图像去分析
下图是原始的 matrix A 的图像,可以看到是一条直线。

下图是由 matrix A 上采样形成的 matrix B 的图像,可以看到现在的图像不再是连续的,而是断断续续的,但是在每个峰的顶点依次对应的值为 1、2、3、4、5、6,而其余的点值均为 0,和之前矩阵的数值就能对应上了。

理解了上采样 upsample 的含义,对于下采样 downsample 就很好理解了,下采样其实就是上采样的逆操作,上采样将一个点扩展到 4 个点,下采样就是将 4 个点缩小至 1 个点,这里依然用实际的程序解释。
下采样 downsample
对 martix_B 进行 4 倍的下采样操作
martix_C = downsample(martix_B,4);
可以看到,此时的 martix_C 和 martix_A 是一致的。

在数据格式上也是一样。

在图像是也是和之前原始的图像一致。

其他参数设定
除此之外,这两个函数还可以添加另一个参数,phase:相位,这个参数可以更改样本数据的相位。
举个栗子
定义一个矩阵 matrix_D,参数 phase 设定为 2
martix_D = upsample(martix_A,4,2);
此时每个数都向右移了 2 位

从图像中也可以看出向右偏移了部分距离

总结
上采样操作将每个输出数据间插入了 3 个 0,这就相当于将采样时间缩短为原来的 1/4,从频率上看,频率变为原来的 1/4。同时数据长度也变为原来的 4 倍。需要注意的是,4 倍升采样后,功率也变为原来的1/4,可以增加增益等方法处理。上采样的意义通俗的讲就在于增加数据与数据直接的间隙,在调制的时候就可以有效的避免产生混叠,下采样的是上采样的逆操作,理解了上采样,下采样自然就懂了。
边栏推荐
- 设计电商秒杀系统
- C语言-单词分析解析
- Lecun predicts AgI: big model and reinforcement learning are both ramps! My world model is the new way
- 第三章 处理机调度练习
- Serious internal entanglement in the we media industry: where should the enterprise we media go
- LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路
- 国盛证券开户是真的安全可靠吗
- 一文搞懂shell脚本
- Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
- See fengzhixia | FENGZikai, the originator of Guoman, for exclusive sale of Digital Collections
猜你喜欢

超级工厂里的生意图鉴

Cs5463 code module analysis (including download link)
![[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word](/img/1a/8416d2c48bf1ddcc45e0c5d9acf242.png)
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word

WMS仓库管理系统模块之波次拣货

直击产业落地 | 飞桨重磅推出业界首个模型选型工具

Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal
![[deep learning] (3) encoder mechanism in transformer, complete pytoch code attached](/img/cb/d385bee7a229e8d11f5fa8af66311f.gif)
[deep learning] (3) encoder mechanism in transformer, complete pytoch code attached

第二章 经典同步练习作业

月薪6万,互联网“降本增效”后,这类人开始被疯抢

See fengzhixia | FENGZikai, the originator of Guoman, for exclusive sale of Digital Collections
随机推荐
Hit the industry directly | the flying propeller launched the industry's first model selection tool
Wave picking of WMS warehouse management system module
C语言-单词分析解析
计数排序和排序的稳定性
【剑指Offer】50. 第一个只出现一次的字符
油猴脚本学习
Chapter III processor scheduling exercise
[mathematical modeling] fmincon() function of MATLAB nonlinear programming
直击产业落地 | 飞桨重磅推出业界首个模型选型工具
Undefined symbol main (referred from entry9a.o).
Go language - reflect
Online linear programming: Dual convergence, new algorithms, and regret bounds
This simple little function saves 213 hours for our production research team in half a year
Non scientific class! The road of self-study!
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
C語言-單詞分析解析
[stm32 Hal library] RTC and BKP drives
[数学建模]Matlab非线性规划之fmincon()函数
[chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
Prometeus 2.36.0 new features