• 【信号处理】基于均分原理的同步信号分割与建模附matlab代码


    💥💥💥💞💞💞欢迎来到本博客❤️❤️❤️💥💥💥

    📝目前更新:🌟🌟🌟智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真。

                             

                                  🎉🎉欢迎您的到来🎉🎉
    
                    ⛅⛅⛅ 📃CSDN主页:Matlab科研室🌈🌈🌈
    
                  📚📚📚📋所有代码目录见微信公众号:天天Matlab👨•💻👨•💻👨•💻

    1 内容介绍

    在本文中,我们提出了一种基于 EquiPartition 原则 (EP) 的信号时间间隔分割方法。 根据 EP,信号被分割成段,在重建中给出相等的误差,选择最合适的模型来描述每个段。 此外,这些片段在内容域中是等效的,因为信号被分割成由相同数量的系数建模的片段。 所提出的方法已成功应用于不同类型的信号,例如:生理、语音、人体运动、金融时间序列。 最后,所提出的方法在误差标准、信号建模和信号维度的变化上非常灵活,从而产生了一种用于信号分割和建模的鲁棒方法。

    2 仿真代码

    %This code is a simple (not speed optimized) implementation of EP   

    % based Simultaneous Segmentation and Modelling of Signals, see papers [1-3]. 

    %

    close all;

    clear all;

    S = 7;%number of coefficients 

    N = 3;%number of segments 

    %mode = 1;  %FFT

    %mode = 2;  %Polynomial method

    %mode = 3;  %Wavelet method

    mode = 4;  %Selection between FFT + Polynomial method + Wavelet (basis selection)

    file = 'data\synSignal3Seg-noise_0_025.txt'; %data file

    %read data

    fid = fopen(file, 'r');

    a = fscanf(fid, '%g', [inf]);    

    a = a';

    fclose(fid);

    y = a';

    figure;

    plot(y);

    xlabel('samples');

    title('signal');

    %compute distance matrix 

    warning('off','all');

    [d,meth] = getDistanceFromSignal(y,4,S,1);

    %write distance matrix 

    fileD = sprintf('%s_D.txt',file(1:length(file)-4));

    fid = fopen(fileD, 'w');

    for i=1:size(d,1),

        fprintf(fid,'%f ',d(i,:));

        fprintf(fid,'\n');

    end

    fclose(fid);

    %%%EP starts

    command = sprintf('ep %s %d data\\ epRes_signal4SegN1-noise',fileD,N); 

    dos(command);

    [Sol1,error1] =  getBestSolution(d,'solutionsEQP.txt',N,1);

    [Sol2,error2] =  getBestSolution(d,'solutions.txt',N,2);

    if error1 < error2,

        Sol = round(Sol1);

    else

        Sol = round(Sol2);

    end

    fclose(fid);

    %Sol stores the best EP solution 

    Segments = Sol;

    [y_,error,method] =  getReconstruction(y,Segments,mode,S,1);

    figure;

    hold on;

    plot(y,'LineWidth',1.2);

    hold on;

    plot(y_,'r');

    hold on;

    %plot(x(points),0,'gs','MarkerFaceColor','g','MarkerSize',6);

    for i=2:length(Segments)-1,

        plot([Segments(i) Segments(i)],[min(y) max(y)],'-.k');

    end

    for i=1:length(Segments)-1,

        if method(i) == 1,

            text(-10+(Segments(i)+Segments(i+1))/2,(min(y)+max(y))/2,'Fourier');

        elseif method(i) == 2,

            text(-10+(Segments(i)+Segments(i+1))/2,(min(y)+max(y))/2,'Polynomial');

        else

            text(-10+(Segments(i)+Segments(i+1))/2,(min(y)+max(y))/2,'Wavelets');

        end 

    end

    s = sprintf('N = %d,  Error = %2.4f, S = %d ',N,error, S);

    title(s); 

    legend('Original','Reconstruction','Segmentation');

    xlabel('samples');

    3 运行结果

    4 参考文献

    [1] C. Panagiotakis, K. Athanassopoulos and G. Tziritas, The equipartition of curves,Computational Geometry: Theory and Applications, Vol. 42, No. 6-7, pp. 677-689, 2009.

    [2] C. Panagiotakis and G. Tziritas, Signal Segmentation and Modelling based on Equipartition Principle,  International Conference on Digital Signal Processing, 2009.

    [3] C. Panagiotakis and G. Tziritas, Simultaneous Segmentation and Modelling of Signals based on an Equipartition Principle, 20th International Conference for Pattern Recognition  (ICPR), 2010.

    博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

    部分理论引用网络文献,若有侵权联系博主删除。

    5 往期回顾扫扫下方二维码

  • 相关阅读:
    QQ五毛项目记
    Python小练03
    ReACT介绍与llama_index ReActAgent实践
    类图 UML从入门到放弃系列之二
    4. 线性回归以及基础优化算法
    Python源码剖析1-整数对象PyIntObject
    POI版本升级需要调整的代码整理(3.15升级到5.1.0版本)
    笔试面试相关记录(6)
    单商户商城系统功能拆解39—分销应用—分销等级
    Springboot发送邮件
  • 原文地址:https://blog.csdn.net/qq_59747472/article/details/126338042