时频转换 | Matlab基于递归图Reccurence Plots一维数据转二维图像方法

目录

基本介绍

时频转换 | Matlab基于递归图Reccurence Plots一维数据转二维图像方法

程序设计

matlab 复制代码
clear
clc
close all

fs = 6400 ; % 数据采样频率
N = 5120; % 信号的点数

% 生成时间向量
t = (0:N-1) / fs;
% 生成正弦信号
x = sin(2 * pi * 150 * t);
output_folder = './figures';  % 指定输出频谱文件夹路径(此处默认为本代码文件夹)
%% 滑动窗口划分样本
window_length = 1024;  % 窗口长度
step_size = 1024;  % 步长
t = (0:window_length-1)/fs;
f=(fs/2)/(window_length/2):(fs/2)/(window_length/2):(fs/2);
num_samples = floor((length(x) - window_length) / step_size) + 1;  % 样本数量

% 初始化样本矩阵
samples = zeros(window_length, num_samples);

% 滑动窗口划分数据样本
for i = 1:num_samples
    start_index = (i - 1) * step_size + 1;  % 窗口起始索引
    end_index = start_index + window_length - 1;  % 窗口结束索引
    
    % 判断是否滑动至最后一个窗口
    if end_index <= length(x)
        samples(:, i) = x(start_index:end_index);
    else
        % 忽略最后一个窗口
        break;
    end
end

参考资料

1\] https://blog.csdn.net/kjm13182345320/article/details/129215161 \[2\] https://blog.csdn.net/kjm13182345320/article/details/128105718 ## 获取方式 点击文章底部联系博主

相关推荐
studyer_domi13 小时前
Matlab 234-锂电池充放电仿真
开发语言·matlab
翱翔-蓝天1 天前
MATLAB 在医疗行业的应用
开发语言·matlab
hie988941 天前
matlab稳定求解高精度二维对流扩散方程
算法·机器学习·matlab
买了一束花1 天前
MATLAB导出和导入Excel文件表格数据并处理
人工智能·算法·matlab
是代码侠呀2 天前
飞蛾扑火算法matlab实现
开发语言·算法·matlab·github·github star·github 加星
phoenix@Capricornus2 天前
MATLAB Deep Learning Toolbox
人工智能·深度学习·matlab
passionSnail2 天前
《用MATLAB玩转游戏开发》Flappy Bird:小鸟飞行大战MATLAB趣味实现
开发语言·matlab
yt948322 天前
Matlab实现绘制任意自由曲线
开发语言·matlab
IT猿手2 天前
基于 Q-learning 的城市场景无人机三维路径规划算法研究,可以自定义地图,提供完整MATLAB代码
深度学习·算法·matlab·无人机·强化学习·qlearning·无人机路径规划
机器学习之心2 天前
MATLAB的cvpartition函数用法
matlab