数字信号处理-希尔伯特变换
Hilbert变换时信号分析的一个重要工具,在信号处理系统和通信系统中是非常有用的。主要作用有以下三点:
1、用来构建解析信号,使信号频谱仅含有正频率成分,从而降低信号的抽样率;
2、可以用来表示带通信号,从而为无线电通信中的信号调制提供了一种方法;
3、与其他变换及分解结合在一起,进行非平稳信号的频谱分析。
希尔伯特变换定义如下:
希尔伯特变换matlab代码
function x = hilbert(xr,n) %HILBERT Discrete-time analytic signal via Hilbert transform. % X = HILBERT(Xr) computes the so-called discrete-time analytic signal % X = Xr + i*Xi such that Xi is the Hilbert transform of real vector Xr. % If the input Xr is complex, then only the real part is used: Xr=real(Xr). % If Xr is a matrix, then HILBERT operates along the columns of Xr. % % HILBERT(Xr,N) computes the N-point Hilbert transform. Xr is padded with % zeros if it has less than N points, and truncated if it has more. % % For a discrete-time analytic signal X, the last half of fft(X) is zero, % and the first (DC) and center (Nyquist) elements of fft(X) are purely real. % % EXAMPLE: % Xr = [1 2 3 4]; % X = hilbert(Xr) % % produces X=[1+1i 2-1i 3-1i 4+1i] such that Xi=imag(X)=[1 -1 -1 1] is the % % Hilbert transform of Xr, and Xr=real(X)=[1 2 3 4]. Note that the last half % % of fft(X)=[10 -4+4i -2 0] is zero (in this example, the last half is just % % the last element). Also note that the DC and Nyquist elements of fft(X) % % (10 and -2) are purely real. % % See also FFT, IFFT, ENVELOPE.% Copyright 1988-2008 The MathWorks, Inc.% References: % [1] Alan V. Oppenheim and Ronald W. Schafer, Discrete-Time % Signal Processing, 2nd ed., Prentice-Hall, Upper Saddle River, % New Jersey, 1998. % % [2] S. Lawrence Marple, Jr., Computing the discrete-time analytic % signal via FFT, IEEE Transactions on Signal Processing, Vol. 47, % No. 9, September 1999, pp.2600--2603.%#codegennarginchk(1,2); if isempty(coder.target)if nargin == 1x = hilbert_ml(xr);elsex = hilbert_ml(xr,n);end elseif nargin == 1x = hilbert_cg(xr);elsecoder.internal.prefer_const(n);x = hilbert_cg(xr,n);end end%--------------------------------------------------------------------------function x = hilbert_ml(xr,n) if nargin<2, n=[]; end if ~isreal(xr)warning(message('signal:hilbert:Ignore'))xr = real(xr); end % Work along the first nonsingleton dimension [xr,nshifts] = shiftdim(xr); if isempty(n)n = size(xr,1); end x = fft(xr,n,1); % n-point FFT over columns. h = zeros(n,~isempty(x)); % nx1 for nonempty. 0x0 for empty. if n > 0 && 2*fix(n/2) == n% even and nonemptyh([1 n/2+1]) = 1;h(2:n/2) = 2; elseif n>0% odd and nonemptyh(1) = 1;h(2:(n+1)/2) = 2; end x = ifft(x.*h(:,ones(1,size(x,2))),[],1);% Convert back to the original shape. x = shiftdim(x,-nshifts);%--------------------------------------------------------------------------function x = hilbert_cg(xr,n) narginchk(1,2); if nargin == 2coder.internal.prefer_const(n); end if ~isreal(xr)coder.internal.warning('signal:hilbert:Ignore');if nargin == 2x = hilbert_cg(real(xr),n);elsex = hilbert_cg(real(xr));endreturn end % Operate over first non-singleton dimension. dim = HilbertNonSingletonDim(xr); if nargin == 1x = coder.nullcopy(complex(xr));if isvector(xr)x(:) = HilbertColumnwise(xr(:));elseif dim == 1x(:) = HilbertColumnwise(xr);else% Use reshape rather than shiftdim because the code generation% shiftdim ultimately requires a fixed number of shifts.ncols = coder.internal.prodsize(xr,'above',dim);xrshifted = reshape(xr,size(xr,dim),ncols);x(:) = HilbertColumnwise(xrshifted);end elsesz = size(xr);sz(dim) = n;x = coder.nullcopy(zeros(sz,'like',complex(xr)));if isvector(xr)x(:) = HilbertColumnwise(xr(:),n);elseif dim == 1x(:) = HilbertColumnwise(xr,n);else% Use reshape rather than shiftdim because the code generation% shiftdim ultimately requires a fixed number of shifts.ncols = coder.internal.prodsize(xr,'above',dim);xrshifted = reshape(xr,size(xr,dim),ncols);x(:) = HilbertColumnwise(xrshifted,n);end end%--------------------------------------------------------------------------function x = HilbertColumnwise(xr,n) if nargin == 2coder.internal.prefer_const(n);x = fft(xr,n,1); % n-point FFT over columns. elsen = size(xr,1);x = fft(xr,[],1); % n-point FFT over columns. end nrows = coder.internal.indexInt(max(0,n)); ncols = coder.internal.prodsize(x,'above',1); ONE = coder.internal.indexInt(1); halfn = eml_rshift(nrows,ONE); if eml_bitand(nrows,ONE) == 0lastIndexToDouble = halfn; elselastIndexToDouble = halfn + 1; end firstIndexToZero = halfn + 2; for j = 1:ncolsfor i = 2:lastIndexToDoublex(i,j) = x(i,j)*2;endfor i = firstIndexToZero:nrowsx(i,j) = 0;end end x = ifft(x,[],1);%--------------------------------------------------------------------------function dim = HilbertNonSingletonDim(x) % Like MATLAB's first nonsingleton dim except for scalars returns 1 instead % of 2. ONE = coder.internal.indexInt(1); dim = ONE; for k = ONE:eml_ndims(x)if size(x,k) ~= 1dim = k;breakend end%--------------------------------------------------------------------------
希尔伯特变换matlab实战代码--提取信号的瞬时振幅、瞬时相位和瞬时频率
%希尔伯特变换demo clc clear Fs = 2e3; ts = 0:1/Fs:5; sig = sin(ts*2*pi*50); sig_ht = hilbert(sig); sig_r = real(sig_ht); sig_i = imag(sig_ht); %%瞬时振幅 IA = sqrt(sig_r.^2+sig_i.^2); subplot(4,1,1) plot(ts,sig) subplot(4,1,2) plot(ts,IA) %%瞬时相位 IP = angle(sig_ht); subplot(4,1,3) plot(ts,IP) %%瞬时频率 d_t = diff(ts); d_IP = diff(IP); IF = (d_IP./d_t)/2/pi; subplot(4,1,4) plot(ts(2:end),IF)
结果展示
关注我下期分享更多信号处理方法~
数字信号处理-希尔伯特变换相关推荐
- 数字信号处理之变换:傅里叶变换、短时傅里叶变换、小波变换等
傅里叶变换.拉普拉斯变换.自(互)相关及卷积是线性系统分析里最重要的四个数学工具. 数字信号处理中常用的几种变换:傅里叶变换.短时傅里叶变换.小波变换.希尔伯特-黄变换.拉普拉斯变换. 线性变换:傅里 ...
- 【数字信号处理】希尔伯特变换系列1之相位处理(含MATLAB代码)
利用希尔伯特变换进行相位处理 相位的频域处理 在讨论"理想DFT滤波"时,我们注意到通常信号的相位将保持不变,这意味着不会发生由非线性相位引起的失真.然而,应该总是考虑相位响应(或 ...
- java dsp_GitHub - Onemeaning/JavaDsp: 数字信号处理(DSP)方面的Java封装,包含常用的一些处理方法,如滤波、信号变换等等。...
JavaDsp 数字信号处理(DSP)方面的Java封装,包含常用的一些处理方法,如滤波.信号变换等等. 该类库是我本科毕业设计中的一部分,绝大部分都是我自己写实现的,很少部分算法有我另外几个朋友参与 ...
- z变换判断稳定性和因果性_数字信号处理(王娜)-中国大学mooc-题库零氪
第1周 Topic 1 数字信号处理的概述 Topic1的单元测验数字信号处理的特点及应用介绍 1.在实际通信系统中,进入到数字信号处理(DSP)模块的输入与输出信号形式通常分别是() A.模拟信号, ...
- 【20220207】【信号处理】希尔伯特变换定义及解调原理
一.解析信号 1. 定义 解析信号是没有负频率分量的复值函数,解析信号的实部和虚部是由希尔伯特变换相关联的实值函数. (参考:解析信号) 2. 概念 一个实值函数 的 Hilbert 变换记作为 , ...
- 数字信号处理学习笔记[0] 连续信号的频谱和傅氏变换
文章目录 绪论 1 连续信号的频谱和傅氏变换 1.1 有限区间上连续信号的傅氏级数和离散频谱 1.2 傅氏变换,连续信号与频谱 1.2.3 频谱的基本性质 实际应用举例 习题 绪论 Q: 举例说明&q ...
- 数字信号处理知识点总结(二):傅里叶级数与变换
本篇文章主要介绍傅里叶级数和傅里叶变换的概念.作用及分类. 目录 1. 分解与变换 2. 四种傅里叶级数及变换 2.1 连续时间傅里叶变换(CTFT) 2.2 连续时间傅里叶级数(CFS) 2.3 离 ...
- VLSI数字信号处理系统——第九章滤波器和变换中的算法强度缩减
VLSI数字信号处理系统--第九章滤波器和变换中的算法强度缩减 作者:夏风喃喃 参考: (1) VLSI数字信号处理系统:设计与实现 (美)Keshab K.Parhi/著 (2) socvista ...
- 直接数字下变频(3):希尔伯特变换法
希尔伯特变换法 希尔伯特变换后的信号和原信号经适当组合可以实现负频谱相互抵消,从而避免了单路相位检波引起的正负频谱混叠.希尔伯特变换将原信号频谱大于0的部分移相,将原信号频谱小于0的部分移相. 为原实 ...
- 数字信号处理-9-离散余弦变换
1 波形合成 假定给一系列振幅和一系列频率,要求构建一个信号,此信号是这些频率元素的和.这样的操作就是合成 def synthesize(amps, fs, ts):""" ...
最新文章
- awk1.0 — awk基础
- xlrd、xlwt操作execl表格
- 逻辑电平0和1的世界
- IT接口——Micro USB带来的市场影响力
- JavaFX 8的弹出式编辑器
- 链表面试题3:将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成 的。
- 【word基础知识】word转pdf时出现空白页如何删除?
- php强大的函数,PHP最强大的随机字符串生成函数
- Jupyter notebook基础教程(启动,汉化,操作)
- ubuntu添加默认路由才可以访问网络
- 数据结构之二叉查找树介绍
- 存储过程和函数的操作
- 初中七年级上计算机试题答案,初中信息技术考试试题(含答案).docx
- 初识深度信念网络DBN
- 如何提升自己(一) 谈学习
- 关于音频情感分类的随笔(3)
- 日本杂货连锁Loft海外首家直营店上海开业;豪森药业创新药首次“出海” | 美通企业日报...
- 如何删除word中页眉的横线
- 从浏览器沦为系统毒瘤:无法禁用的IE背后,是几百亿的家族生意。。。
- time.h头文件解析