一维时间序列信号的广义傅里叶族变换(Matlab)

广义傅里叶族变换是一种时频变换方法,傅里叶变换、短时傅里叶变换、S变换和许多小波变换都是其特殊情况,完整代码及子函数如下,很容易读懂:

% Run a demo by creating a signal, transforming it, and plotting the results% Create a fake signalN = 256;x = linspace(0,1,N);sig = zeros(1,length(x));% signal example 1 (a single delta)sig(N/2) = 1.0;% signal example 2 (a mixture of sinusoids and a delta)% sig(1:N/2) += (sin((N/16)*2*pi*x)*1.0)(1:N/2);% sig(N/2+1:N) += (cos((N/8)*2*pi*x)*1.0)(N/2+1:N);% sig(2*N/16+1:3*N/16) += (sin((N/4)*2*pi*x)*1.0)(2*N/16+1:3*N/16);% sig(N/2+N/4+1) = 2.0;% Do the transformpartitions = octavePartitions(N);windows = boxcarWindows(partitions);SIG = GFT(sig,partitions,windows);% Interpolate to get a spectrogram% The third and fourth parameters set the time and frequency axes respectively,% and can be changed to raise or lower the resolution, or zoom in on% a feature of interestspectrogram = interpolateGFT(SIG,partitions,1024,1024);% Displayfigure();subplot(3,1,1);plot(x,sig,'DisplayName','signal');legend('Location','northeast')ax = subplot(3,1,2);hold on;for p = partitionsline([x(p),x(p)],[0,max(abs(SIG))],'Color',[1 0 0],'linestyle','--');endp = plot(x,abs(SIG),'DisplayName','SIGNAL');legend(p,'Location','northeast');subplot(3,1,3);imagesc(abs(spectrogram));%%
function partitions = octavePartitions(N)widths = 2.^(0:round(log(N)/log(2)-2));widths = [1,widths,flip(widths)];partitions = [0,cumsum(widths)]+1;
end%%
function widths = partitionWidths(partitions)widths = circshift(partitions,-1) - partitions;widths(length(partitions)) = widths(length(partitions)) + max(partitions);
end%%
function windows = boxcarWindows(partitions)windows = ones(1,max(partitions));
end%%
function SIG = GFT(sig,partitions,windows)SIG = fft(complex(sig));SIG = SIG.*windows;for p = 1:(length(partitions)-1)SIG(partitions(p):partitions(p+1)-1) = ifft(SIG(partitions(p):partitions(p+1)-1));end
end%%
function spectrogram = interpolateGFT(SIG,partitions,tAxis,fAxis,method)% Interpolate a 1D GFT onto a grid. If axes is specified it should be a% list or tuple consisting of two arrays, the sampling points on the time and frequency% axes, respectively. Alternatively, M can be specified, which gives the number% of points along each axis.% introduced in R2019 is the arguments block% https://www.mathworks.com/help/matlab/ref/arguments.html
%     arguments
%         SIG;
%         partitions;
%         tAxis;
%         fAxis;
%         method (1,:) char = 'linear';
%     end% if you don't have have the arguments block, then you can still do input defaults like this:if nargin<5method = 'linear';end% Caller specified M rather than the actual sampling pointsif length(tAxis) == 1tAxis = 1:length(SIG) / tAxis:length(SIG);% Centre the samplestAxis = tAxis + (length(SIG) - tAxis(length(tAxis))) / 2;endif length(fAxis) == 1fAxis = 1:length(SIG) / fAxis:length(SIG);% Centre the samplesfAxis = fAxis + (length(SIG) - fAxis(length(fAxis))) / 2;endN = length(SIG);widths = partitionWidths(partitions);spectrogram = complex(length(partitions),zeros(length(tAxis)));% interpolate each frequency band in timefor p = 1:length(partitions)% indices of sample points, plus 3 extra on each side in case of cubic interpolationindices = (-3:widths(p)+2);% time coordinates of samplest = indices .* (N/widths(p));% values at sample pointsif (p < length(partitions))temp = SIG(partitions(p):partitions(p+1)-1);f = temp(mod(indices,widths(p))+1);elsetemp = SIG(partitions(p):N);f = temp(mod(indices,widths(p))+1);endif (length(f) > 1)spectrogram(p,:) = interp1(t,f,tAxis,method);elsespectrogram(p,:) = f;endend% Interpolate in frequencyindices = mod(-3:length(partitions)+2,length(partitions));f = partitions(indices+1) + widths(indices+1)/2;f(1:3) = f(1:3) - N;f(length(f)-2:length(f)) = f(length(f)-2:length(f)) + N;t = spectrogram(indices+1,:);spectrogram = interp1(f,t,fAxis,method);
endfunction [sig,partitions,windows,SIG] = demo()% Run a demo by creating a signal, transforming it, and plotting the results% Create a fake signalN = 256;x = linspace(0,1,N);sig = zeros(1,length(x));% signal example 1 (a single delta)sig(N/2) = 1.0;% signal example 2 (a mixture of sinusoids and a delta)% sig(1:N/2) += (sin((N/16)*2*pi*x)*1.0)(1:N/2);% sig(N/2+1:N) += (cos((N/8)*2*pi*x)*1.0)(N/2+1:N);% sig(2*N/16+1:3*N/16) += (sin((N/4)*2*pi*x)*1.0)(2*N/16+1:3*N/16);% sig(N/2+N/4+1) = 2.0;% Do the transformpartitions = octavePartitions(N);windows = boxcarWindows(partitions);SIG = GFT(sig,partitions,windows);% Interpolate to get a spectrogram% The third and fourth parameters set the time and frequency axes respectively,% and can be changed to raise or lower the resolution, or zoom in on% a feature of interestspectrogram = interpolateGFT(SIG,partitions,1024,1024);% Displayfigure();subplot(3,1,1);plot(x,sig,'DisplayName','signal');legend('Location','northeast')ax = subplot(3,1,2);hold on;for p = partitionsline([x(p),x(p)],[0,max(abs(SIG))],'Color',[1 0 0],'linestyle','--');endp = plot(x,abs(SIG),'DisplayName','SIGNAL');legend(p,'Location','northeast');subplot(3,1,3);imagesc(abs(spectrogram));
end

图片

工学博士,担任《Mechanical System and Signal Processing》《中国电机工程学报》《控制与决策》等期刊审稿专家,擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/20080.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

不同厂商SOC芯片在视频记录仪领域的应用

不同SoC公司芯片在不同产品上的应用信息&#xff1a; 大唐半导体 芯片型号: LC1860C (主控) LC1160 (PMU)产品应用: 红米2A (399元)大疆晓Spark技术规格: 28nm工艺&#xff0c;4个ARM Cortex-A7处理器&#xff0c;1.5GHz主频&#xff0c;2核MaliT628 GPU&#xff0c;1300万像…

计算属性与监听属性

【 1 】计算属性 计算属性大致就是这样 # 1 计算属性是基于它们的依赖进行缓存的# 2 计算属性只有在它的相关依赖发生改变时才会重新求值# 3 计算属性就像Python中的property&#xff0c;可以把方法/函数伪装成属性 # 计算属性本质上是一个函数&#xff0c;它们可以通过 get…

数据隐私新篇章:Facebook如何保护用户信息

随着数字化时代的到来&#xff0c;数据隐私保护成为了社交媒体平台和用户共同关注的焦点。作为全球最大的社交网络之一&#xff0c;Facebook一直致力于保护用户的隐私和数据安全。本文将深入探讨Facebook在数据隐私保护方面的措施和实践&#xff0c;以及其如何开启数据隐私的新…

vue实现简易基本对话功能

基于vue3.0实现的功能&#xff0c;仿照微信、QQ聊天界面。 HTML代码块 <template><el-container style"height: 100%" ref"bodyform"><div class"el_main_content"><div class"main_content_header">这是一…

Git基本配置,使用Gitee(一)

1、设置Giter的user name和email 设置提交用户的信息 git config --global user.name "username" git config --global user.email "Your e-mail"查看配置 git config --list2、生成 SSH 公钥 通过命令 ssh-keygen 生成 SSH Key -t key 类型 -C 注释 ssh-…

K8S 证书过期不能使用kubectl之后,kubeadm 重新生成证书

查询证书过期时间 kubeadm certs check-expiration重新生成证书 # 重新生成所有证书 kubeadm certs renew all # 重新生成某个组件的证书 kubeadm certs renew 组件名称 如&#xff1a;apiserver生成新的配置 # 重新生成kubeconfig配置 kubeadm init phase kubeconfig # 重…

LabVIEW中PID控制器系统的噪声与扰动抑制策略

在LabVIEW中处理PID控制器系统中的噪声和外部扰动&#xff0c;需要从信号处理、控制算法优化、硬件滤波和系统设计四个角度入手。采用滤波技术、调节PID参数、增加前馈控制和实施硬件滤波器等方法&#xff0c;可以有效减少噪声和扰动对系统性能的影响&#xff0c;提高控制系统的…

原生小程序一键获取手机号

1.效果图 2.代码index.wxml <!-- 获取手机号 利用手机号快速填写的功能&#xff0c;将button组件 open-type 的值设置为 getPhoneNumber--><button open-type"getPhoneNumber" bindgetphonenumber"getPhoneNumber">获取手机号</button> …

Spring使用的设计模式

Spring 框架是一个广泛使用的 Java 框架&#xff0c;它内部使用了多种设计模式来简化开发过程、提高代码的可维护性和扩展性。 以下是一些在 Spring 框架中常见的设计模式&#xff0c;以及用代码示例来解释它们&#xff1a; 一、工厂模式&#xff08;Factory Pattern&#xff…

elasticsearch7.15实现用户输入自动补全

Elasticsearch Completion Suggester&#xff08;补全建议&#xff09; Elasticsearch7.15安装 官方文档 补全建议器提供了根据输入自动补全/搜索的功能。这是一个导航功能&#xff0c;引导用户在输入时找到相关结果&#xff0c;提高搜索精度。 理想情况下&#xff0c;自动补…

02-CSS3基本样式

目录 1. CSS3简介 1.1 CSS3的兼容情况 1.2 优雅降级和渐进增强的开发思想 2. 新增选择器 2.1 选择相邻兄弟 2.2 匹配选择器 2.3 属性选择器(重点) 2.4 结构性伪类选择器&#xff08;重点&#xff09; 2.4.1 整体结构类型 2.4.2 标签结构类型 2.4.3 指定子元素的序号&…

模型训练、结果存储、API 调用的系列优化|ModelWhale 版本更新

蜂飞蝶舞&#xff0c;万物并秀&#xff0c;明媚的春光中 ModelWhale 带来新一轮的版本更新&#xff0c;期待为大家带来更优质的使用体验。 本次更新中&#xff0c;ModelWhale 主要进行了以下功能迭代&#xff1a; 新增 IDE 中使用训练记录&#xff08;专业版✓ 团队版✓&…

Ansible04-Ansible Vars变量详解

目录 写在前面6 Ansible Vars 变量6.1 playbook中的变量6.1.1 playbook中定义变量的格式6.1.2 举例6.1.3 小tip 6.2 共有变量6.2.1 变量文件6.2.1.1 变量文件编写6.2.1.2 playbook编写6.2.1.3 运行测试 6.2.2 根据主机组使用变量6.2.2.1 groups_vars编写6.2.2.2 playbook编写6.…

迈的普拉姆利普绘图:深入解析与实战应用

新书上架~&#x1f447;全国包邮奥~ python实用小工具开发教程http://pythontoolsteach.com/3 欢迎关注我&#x1f446;&#xff0c;收藏下次不迷路┗|&#xff40;O′|┛ 嗷~~ 目录 一、引言&#xff1a;matplotlib绘图的基本原理 代码案例 二、深入了解&#xff1a;matplo…

数据结构与算法02-排序算法

介绍 排序算法是计算机科学中被广泛研究的一个课题。历时多年&#xff0c;它发展出了数十种算法&#xff0c;这些 算法都着眼于一个问题&#xff1a;如何将一个无序的数字数组整理成升序&#xff1f;先来学习一些“简单排序”&#xff0c;它们很好懂&#xff0c;但效率不如其他…

闽盾杯 2021 DNS协议分析

今年CISCN的Tough DNS 的前戏就是DNS协议分析 直接可以查找到flag的base64形式Zmxh 发现就是请求的dnslog 携带的数据 过滤器就是 dns tshark -r dns.pcapng -T json -Y "dns" >1.json 字段选择 dns.qry.name tshark -r dns.pcapng -T json -Y "dns"…

内网渗透-隧道搭建ssp隧道代理工具

内网渗透-隧道搭建&ssp隧道代理工具 目录 内网渗透-隧道搭建&ssp隧道代理工具spp隧道代理工具spp工作原理图cs上线主机spp代理通信服务端配置客户端配置CS配置设置CS生成木马的监听器配置CS监听上线的监听器生成木马 spp隧道搭建服务端配置客户端配置CS配置 内网穿透&a…

根据模板和git commit自动生成日·周·月·季报

GitHub - qiaotaizi/dailyreport: 日报生成器 GitHub - yurencloud/daily: 程序员专用的日报、周报、月报、季报自动生成器&#xff01; config.json: { "Author": "gitname", "Exclude": ["update:", "add:", "…

实际测试stm32中断优先级

HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority); void HAL_NVIC_EnableIRQ(IRQn_Type IRQn); void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);第一个函数 HAL_NVIC_SetPriority 是用来设置单个优先级的抢占优先级和响应优先级的值。第二个…

恒压频比开环控制系统Matlab/Simulink仿真分析(SPWM控制方式)

介绍恒压频比的开环控制方法驱动永磁同步电机的转动&#xff0c;首先分析恒压频比的控制原理&#xff0c;然后在Matlab/Simulink中进行永磁同步电机恒压频比开环控制系统的仿真分析&#xff0c;最后将Simulink中的恒压频比控制算法生成代码加载到实际工程中进行工程实现。 一、…