求基于matlab的EMD代码,急!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求基于matlab的EMD代码,急!相关的知识,希望对你有一定的参考价值。

最好对于某些变量,函数有点解释,方便理解,谢谢
2楼的是svm,差点被你骗过去了

没人回答,晕

参考技术A >>edit svmtrain
>>edit svmclassify
>>edit svmpredict

function [svm_struct, svIndex] = svmtrain(training, groupnames, varargin)
%SVMTRAIN trains a support vector machine classifier
%
% SVMStruct = SVMTRAIN(TRAINING,GROUP) trains a support vector machine
% classifier using data TRAINING taken from two groups given by GROUP.
% SVMStruct contains information about the trained classifier that is
% used by SVMCLASSIFY for classification. GROUP is a column vector of
% values of the same length as TRAINING that defines two groups. Each
% element of GROUP specifies the group the corresponding row of TRAINING
% belongs to. GROUP can be a numeric vector, a string array, or a cell
% array of strings. SVMTRAIN treats NaNs or empty strings in GROUP as
% missing values and ignores the corresponding rows of TRAINING.
%
% SVMTRAIN(...,'KERNEL_FUNCTION',KFUN) allows you to specify the kernel
% function KFUN used to map the training data into kernel space. The
% default kernel function is the dot product. KFUN can be one of the
% following strings or a function handle:
%
% 'linear' Linear kernel or dot product
% 'quadratic' Quadratic kernel
% 'polynomial' Polynomial kernel (default order 3)
% 'rbf' Gaussian Radial Basis Function kernel
% 'mlp' Multilayer Perceptron kernel (default scale 1)
% function A kernel function specified using @,
% for example @KFUN, or an anonymous function
%
% A kernel function must be of the form
%
% function K = KFUN(U, V)
%
% The returned value, K, is a matrix of size M-by-N, where U and V have M
% and N rows respectively. If KFUN is parameterized, you can use
% anonymous functions to capture the problem-dependent parameters. For
% example, suppose that your kernel function is
%
% function k = kfun(u,v,p1,p2)
% k = tanh(p1*(u*v')+p2);
%
% You can set values for p1 and p2 and then use an anonymous function:
% @(u,v) kfun(u,v,p1,p2).
%
% SVMTRAIN(...,'POLYORDER',ORDER) allows you to specify the order of a
% polynomial kernel. The default order is 3.
%
% SVMTRAIN(...,'MLP_PARAMS',[P1 P2]) allows you to specify the
% parameters of the Multilayer Perceptron (mlp) kernel. The mlp kernel
% requires two parameters, P1 and P2, where K = tanh(P1*U*V' + P2) and P1
% > 0 and P2 < 0. Default values are P1 = 1 and P2 = -1.
%
% SVMTRAIN(...,'METHOD',METHOD) allows you to specify the method used
% to find the separating hyperplane. Options are
%
% 'QP' Use quadratic programming (requires the Optimization Toolbox)
% 'LS' Use least-squares method
%
% If you have the Optimization Toolbox, then the QP method is the default
% method. If not, the only available method is LS.
%
% SVMTRAIN(...,'QUADPROG_OPTS',OPTIONS) allows you to pass an OPTIONS
% structure created using OPTIMSET to the QUADPROG function when using
% the 'QP' method. See help optimset for more details.
%
% SVMTRAIN(...,'SHOWPLOT',true), when used with two-dimensional data,
% creates a plot of the grouped data and plots the separating line for
% the classifier.
%
% Example:
% % Load the data and select features for classification
% load fisheriris
% data = [meas(:,1), meas(:,2)];
% % Extract the Setosa class
% groups = ismember(species,'setosa');
% % Randomly select training and test sets
% [train, test] = crossvalind('holdOut',groups);
% cp = classperf(groups);
% % Use a linear support vector machine classifier
% svmStruct = svmtrain(data(train,:),groups(train),'showplot',true);
% classes = svmclassify(svmStruct,data(test,:),'showplot',true);
% % See how well the classifier performed
% classperf(cp,classes,test);
% cp.CorrectRate
%
% See also CLASSIFY, KNNCLASSIFY, QUADPROG, SVMCLASSIFY.

% Copyright 2004 The MathWorks, Inc.
% $Revision: 1.1.12.1 $ $Date: 2004/12/24 20:43:35 $

% References:
% [1] Kecman, V, Learning and Soft Computing,
% MIT Press, Cambridge, MA. 2001.
% [2] Suykens, J.A.K., Van Gestel, T., De Brabanter, J., De Moor, B.,
% Vandewalle, J., Least Squares Support Vector Machines,
% World Scientific, Singapore, 2002.
% [3] Scholkopf, B., Smola, A.J., Learning with Kernels,
% MIT Press, Cambridge, MA. 2002.

%
% SVMTRAIN(...,'KFUNARGS',ARGS) allows you to pass additional
% arguments to kernel functions.

% set defaults

plotflag = false;
qp_opts = [];
kfunargs = ;
setPoly = false; usePoly = false;
setMLP = false; useMLP = false;
if ~isempty(which('quadprog'))
useQuadprog = true;
else
useQuadprog = false;
end
% set default kernel function
kfun = @linear_kernel;

% check inputs
if nargin < 2
error(nargchk(2,Inf,nargin))
end

numoptargs = nargin -2;
optargs = varargin;

% grp2idx sorts a numeric grouping var ascending, and a string grouping
% var by order of first occurrence

[g,groupString] = grp2idx(groupnames);

% check group is a vector -- though char input is special...
if ~isvector(groupnames) && ~ischar(groupnames)
error('Bioinfo:svmtrain:GroupNotVector',...
'Group must be a vector.');
end

% make sure that the data is correctly oriented.
if size(groupnames,1) == 1
groupnames = groupnames';
end
% make sure data is the right size
n = length(groupnames);
if size(training,1) ~= n
if size(training,2) == n
training = training';
else
error('Bioinfo:svmtrain:DataGroupSizeMismatch',...
'GROUP and TRAINING must have the same number of rows.')
end
end

% NaNs are treated as unknown classes and are removed from the training
% data
nans = find(isnan(g));
if length(nans) > 0
training(nans,:) = [];
g(nans) = [];
end
ngroups = length(groupString);

if ngroups > 2
error('Bioinfo:svmtrain:TooManyGroups',...
'SVMTRAIN only supports classification into two groups.\nGROUP contains %d different groups.',ngroups)
end
% convert to 1, -1.
g = 1 - (2* (g-1));

% handle optional arguments

if numoptargs >= 1
if rem(numoptargs,2)== 1
error('Bioinfo:svmtrain:IncorrectNumberOfArguments',...
'Incorrect number of arguments to %s.',mfilename);
end
okargs = 'kernel_function','method','showplot','kfunargs','quadprog_opts','polyorder','mlp_params';
for j=1:2:numoptargs
pname = optargsj;
pval = optargsj+1;
k = strmatch(lower(pname), okargs);%#ok
if isempty(k)
error('Bioinfo:svmtrain:UnknownParameterName',...
'Unknown parameter name: %s.',pname);
elseif length(k)>1
error('Bioinfo:svmtrain:AmbiguousParameterName',...
'Ambiguous parameter name: %s.',pname);
else
switch(k)
case 1 % kernel_function
if ischar(pval)
okfuns = 'linear','quadratic',...
'radial','rbf','polynomial','mlp';
funNum = strmatch(lower(pval), okfuns);%#ok
if isempty(funNum)
funNum = 0;
end
switch funNum %maybe make this less strict in the future
case 1
kfun = @linear_kernel;
case 2
kfun = @quadratic_kernel;
case 3,4
kfun = @rbf_kernel;
case 5
kfun = @poly_kernel;
usePoly = true;
case 6
kfun = @mlp_kernel;
useMLP = true;
otherwise
error('Bioinfo:svmtrain:UnknownKernelFunction',...
'Unknown Kernel Function %s.',kfun);
end
elseif isa (pval, 'function_handle')
kfun = pval;
else
error('Bioinfo:svmtrain:BadKernelFunction',...
'The kernel function input does not appear to be a function handle\nor valid function name.')
end
case 2 % method
if strncmpi(pval,'qp',2)
useQuadprog = true;
if isempty(which('quadprog'))
warning('Bioinfo:svmtrain:NoOptim',...
'The Optimization Toolbox is required to use the quadratic programming method.')
useQuadprog = false;
end
elseif strncmpi(pval,'ls',2)
useQuadprog = false;
else
error('Bioinfo:svmtrain:UnknownMethod',...
'Unknown method option %s. Valid methods are ''QP'' and ''LS''',pval);

end
case 3 % display
if pval ~= 0
if size(training,2) == 2
plotflag = true;
else
warning('Bioinfo:svmtrain:OnlyPlot2D',...
'The display option can only plot 2D training data.')
end

end
case 4 % kfunargs
if iscell(pval)
kfunargs = pval;
else
kfunargs = pval;
end
case 5 % quadprog_opts
if isstruct(pval)
qp_opts = pval;
elseif iscell(pval)
qp_opts = optimset(pval:);
else
error('Bioinfo:svmtrain:BadQuadprogOpts',...
'QUADPROG_OPTS must be an opts structure.');
end
case 6 % polyorder
if ~isscalar(pval) || ~isnumeric(pval)
error('Bioinfo:svmtrain:BadPolyOrder',...
'POLYORDER must be a scalar value.');
end
if pval ~=floor(pval) || pval < 1
error('Bioinfo:svmtrain:PolyOrderNotInt',...
'The order of the polynomial kernel must be a positive integer.')
end
kfunargs = pval;
setPoly = true;

case 7 % mlpparams
if numel(pval)~=2
error('Bioinfo:svmtrain:BadMLPParams',...
'MLP_PARAMS must be a two element array.');
end
if ~isscalar(pval(1)) || ~isscalar(pval(2))
error('Bioinfo:svmtrain:MLPParamsNotScalar',...
'The parameters of the multi-layer perceptron kernel must be scalar.');
end
kfunargs = pval(1),pval(2);
setMLP = true;
end
end
end
end
if setPoly && ~usePoly
warning('Bioinfo:svmtrain:PolyOrderNotPolyKernel',...
'You specified a polynomial order but not a polynomial kernel');
end
if setMLP && ~useMLP
warning('Bioinfo:svmtrain:MLPParamNotMLPKernel',...
'You specified MLP parameters but not an MLP kernel');
end
% plot the data if requested
if plotflag
[hAxis,hLines] = svmplotdata(training,g);
legend(hLines,cellstr(groupString));
end

% calculate kernel function
try
kx = feval(kfun,training,training,kfunargs:);
% ensure function is symmetric
kx = (kx+kx')/2;
catch
error('Bioinfo:svmtrain:UnknownKernelFunction',...
'Error calculating the kernel function:\n%s\n', lasterr);
end
% create Hessian
% add small constant eye to force stability
H =((g*g').*kx) + sqrt(eps(class(training)))*eye(n);

if useQuadprog
% The large scale solver cannot handle this type of problem, so turn it
% off.
qp_opts = optimset(qp_opts,'LargeScale','Off');
% X=QUADPROG(H,f,A,b,Aeq,beq,LB,UB,X0,opts)
alpha = quadprog(H,-ones(n,1),[],[],...
g',0,zeros(n,1),inf *ones(n,1),zeros(n,1),qp_opts);

% The support vectors are the non-zeros of alpha
svIndex = find(alpha > sqrt(eps));
sv = training(svIndex,:);

% calculate the parameters of the separating line from the support
% vectors.
alphaHat = g(svIndex).*alpha(svIndex);

% Calculate the bias by applying the indicator function to the support
% vector with largest alpha.
[maxAlpha,maxPos] = max(alpha); %#ok
bias = g(maxPos) - sum(alphaHat.*kx(svIndex,maxPos));
% an alternative method is to average the values over all support vectors
% bias = mean(g(sv)' - sum(alphaHat(:,ones(1,numSVs)).*kx(sv,sv)));

% An alternative way to calculate support vectors is to look for zeros of
% the Lagrangians (fifth output from QUADPROG).
%
% [alpha,fval,output,exitflag,t] = quadprog(H,-ones(n,1),[],[],...
% g',0,zeros(n,1),inf *ones(n,1),zeros(n,1),opts);
%
% sv = t.lower < sqrt(eps) & t.upper < sqrt(eps);
else % Least-Squares
% now build up compound matrix for solver

A = [0 g';g,H];
b = [0;ones(size(g))];
x = A\b;

% calculate the parameters of the separating line from the support
% vectors.
sv = training;
bias = x(1);
alphaHat = g.*x(2:end);
end

svm_struct.SupportVectors = sv;
svm_struct.Alpha = alphaHat;
svm_struct.Bias = bias;
svm_struct.KernelFunction = kfun;
svm_struct.KernelFunctionArgs = kfunargs;
svm_struct.GroupNames = groupnames;
svm_struct.FigureHandles = [];
if plotflag
hSV = svmplotsvs(hAxis,svm_struct);
svm_struct.FigureHandles = hAxis,hLines,hSV;
end
参考技术B 你的emd是%
g.
rilling,的那个吗?
len
=
size(imf,1);
for
k
=
1:len
len1
=
length(imf(k,:));
b(k)
=
sum(imf(k,:).*imf(k,:))/len1;%
时域均方值,能量
amp(k,:)
=
abs(imf(k,:));
b(k)
=
sqrt(b(k));
th
=
angle(hilbert(imf(k,:)));%hilbert变换的相位
d(k,:)
=
diff(th)/ts/(2*pi);%求导,得到频率:f
=
(1/2*pi)*d(th)/dt
end
你的频率公式用得有点问题,求出来不应是归一化频率
参考技术C 能否把代码也发我一份,我想把这个方法用在地球化学方面
我邮箱258275248@qq.com
参考技术D 求楼主解答 邮箱362382447@qq.com 感谢万分 第5个回答  2012-02-22 哥们 我现在在做这课程设计 能不能把你的给我看看一下了 727674595@qq.com 谢谢了

心音信号基于matlab GUI EMD心音信号特征提取含Matlab源码 1735期

一、心音诊断系统简介

1 心音
心脏收缩舒张时产生的声音,可用耳或听诊器在胸壁听到,亦可用电子仪器记录下来(心音图)。可分为第一心音(S1)第二心音(S2)。(正常情况下均可听到)。第三心音(S3通常仅在儿童及青少年可听到),第四心音(S4正常情况很少听到)。从心脏产生的心音经过组织的介导传到胸壁表面,其中以骨传导最好。
心音是心脏及心血管系统机械运动状况的反映,其中包含着心脏各个部分本身及相互之间作用的生理和病理信息。心音信号的识别与分类对心血管系统疾病的诊断具有重要的意义,其准确性、可靠性的好坏决定着诊断与治疗心脏病患者的效果。早期的心音识别与分类是医生根据听诊结果来完成的,显然这一过程具有一定的主观性且可靠性不高。随着信号处理与分析技术的不断发展,对心音的研究也逐步由定性分析进入了定量分析的阶段。国内外许多生物医学工程研究人员将传统的模式识别方法,以及神经网络方法用于心音的识别与分类,期望实现心音的自动解释和自动诊断,以便向临床医生提供实用的辅助诊断信息。此外,心音的识别与分类还有助于对心音产生机制的理解。
心音信号研究主要是采用微电子技术,检测技术,现代数字信号处理技术和生物医学工程技术,研究和揭示心音与心脏病之间的关系。
无论是多大单位的记录,人的体重,心率,血压等生理参数,都是时变的,称为心率或者血压的变异性。
心音是在心动周期中,由于心肌收缩和舒张,瓣膜启闭,血流冲击心室壁和大 动脉等因素引起的机械振动,通过周围组织传到胸壁,将耳紧贴胸壁或将听诊器放在胸壁 定部位,听到的声音 通常很容易听到第一和第二心音,有时在某些情况下听到第三或第四心音。
第一心音:S1,发生在心脏收缩期开始,音调低沉,持续时间较长(约0.15秒)。产生的原因包括心室肌的收缩,房室瓣突然关闭以及随后射血入主动脉等引起的振动。第一心音的最佳听诊部位在锁骨中线第五肋间隙或在胸骨右缘。相对于心电图上QRS波开始后0.020.04s,占时0.080.15s
第二心音:S2,发生在心脏舒张期的开始,频率较高,持续时间较短(约0.08秒)。产生的原因是半月瓣关闭,瓣膜互相撞击以及大动脉中血液减速和室内压迅速下降引起的振动。第二心音的最佳听诊部位在第二肋间隙右侧的主动脉瓣区和左侧的肺动脉瓣区。相对于T波终末部。
第三心音和第四心音:
第三心音S3发生在第二心音后0.1~0.2秒,频率低,它的产生与血液快速流入心室使心室和瓣膜发生振动有关,通常仅在儿童能听到,因为 较易传导到体表。相当于T波后距第二心音0.12~0.20s。
第四心音S4由心房收缩引起,也称心房音,相当于心电图上P波后0.15~0.18s,振幅低。

心音杂音对正常心音形成了一定的干扰,但心音杂音的出现对心音信号分析具有实际应用价值和临床意义。
根据杂音出现的时间与S1,S2心音的关系,可分为早,中,晚期杂音。杂音的强度一般可视其振幅与S1比较分类。大于S1,强。小于S1,大于1/3S1,中。低于S1的1/3则为低,仅有轻微振动则为极低振幅杂音。
由于心音信号属于强噪声背景下的人体微弱生物信号,由于心音信号是由复杂的生命体发出的不稳定的自然信号。心音的改变和杂音的出现往往是心脏产生器质性病变的早期症状,心脏内部的物理结构发生变化将直接影响和改变心音信号。

目前广泛应用 的心电图检查是心脏变时性和变传导性的最佳检测方法,但不能用来检测心脏的变力性先天心脏瓣膜受损。心脏传导组织病变引起的心脏机械活动障碍不会首先反应在心电图上,却能首先反应在心音信号上。当冠心病的阻塞达到70%以上时才能引起心电图信号的改变,实际上,达到25%就可以改变心音信号。

2 异常心音
包括S2、S2的异常及收缩期,舒张期的附加音(或额外音)。
① 第一心音异常。指S1增强,减弱或分裂。估计S1的响度,最好是用听诊,心音图判断能力有限。S1增强、减弱或强弱不等的临床情况见表1。S1分裂指M1与T1相距>0.04sec,可见于正常儿童、青年及体瘦者,无重要意义。S1异常分裂时M1与T1相距可大于0.06秒,见于电激动延迟(如右束支传导阻滞等)、机械活动延迟(如房间隔缺损、严重二尖瓣狭窄等。听诊S1分裂在二尖瓣及三尖瓣区最清楚坐位及呼气时更清楚。
② 第二心音异常。包括S2增强,减弱或分裂。
S2增强又分P2增强及A2增强,P2增强见于肺血流量增多(如间隔缺损),肺血管阻力增加;肺静脉压力增高(如二尖瓣狭窄)。P2亢进一般在肺动脉瓣区听到。A2增强见于体循环阻力增高或血流量增多,向肺动脉瓣及心尖区传导,见于 高血压等。
S2减弱又分P2减弱及A2减弱。P2减弱见于肺动脉压低、肺血流量减少或 肺动脉瓣狭窄等。A2减弱见于体循环阻力低、血流减少、血压低、 主动脉瓣狭窄或严重关闭不全。
S2分裂可为生理性。右室射血结束稍晚于左室,吸气时P2延迟出现,此时可听到S2分裂。但呼气时A2与P2接近或重叠,分裂消失。这见于青少年,在肺动脉瓣区听诊明显,坐位时可消失。
S2异常分裂包括宽分裂、固定分裂、逆分裂、分裂减窄。宽分裂是呼气时S2分裂不消失,见于右室射血时间延长或左室射血时间缩短等情况。S2固定分裂指呼吸时A2 -P2间期无明显改变或变动<0.02sec,见于分流量较大的房间隔缺损等。S2逆分裂指A2在P2之后,吸气时A2-P2分裂不显,呼气时P2提早出现,分裂增宽。见于主动脉瓣关闭延迟。S2分裂减窄常由于严重肺动脉高压P2较早出现所致。

3 心音信号分析方法
传统的谱分析方法通过快速傅立叶变换将时,频域关联起来。但FFT时频域分离,并以信号的频率特性时不变,或统计特性稳定为前提。
传统的稳态分析方法反映的是信号的静态频谱特征,对于包括人体心音信号在内的生物学生理信号,由于环境的影响而表现为非平稳时变特性。因此采用经典谱分析方法难以准确反映心音信号的动态变化。
在传统心音分析的基础上,提出了很多方法:
1.短时傅立叶变换(STFT)
2.小波变换
3.其他时频分析方法

二、源代码

function varargout = GUI_2(varargin)
% GUI_2 MATLAB code for GUI_2.fig
%      GUI_2, by itself, creates a new GUI_2 or raises the existing
%      singleton*.
%
%      H = GUI_2 returns the handle to a new GUI_2 or the handle to
%      the existing singleton*.
%
%      GUI_2('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI_2.M with the given input arguments.
%
%      GUI_2('Property','Value',...) creates a new GUI_2 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_2_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GUI_2_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUI_2

% Last Modified by GUIDE v2.5 29-Jan-2022 11:02:32

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_2_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_2_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin1)
    gui_State.gui_Callback = str2func(varargin1);
end

if nargout
    [varargout1:nargout] = gui_mainfcn(gui_State, varargin:);
else
    gui_mainfcn(gui_State, varargin:);
end
% End initialization code - DO NOT EDIT


% --- Executes just before GUI_2 is made visible.
function GUI_2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI_2 (see VARARGIN)

% Choose default command line output for GUI_2
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes GUI_2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_2_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout1 = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global str;
global s1;
global fs1;
[filename,pathname]=...
    uigetfile('*.wav';'*.bmp';'*.gif','choose');
str=[pathname filename];
[s1,fs1] = audioread(str);%读取
figure(1)
s1=s1(1:3000,:);
plot(s1)
title('心音信号')

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global s1;
global y;
win = hamming(1024,'periodic');
S = stft(s1,'Window',win,'OverlapLength',512);
y = mfcc(S,8000);
figure(3)
plot(y)
title('心音信号--mel倒谱特征')

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global s1;
[c,l] = wavedec(s1,5,'db5');
%重构1~4层细节函数

d4 = wrcoef('d',c,l,'db5',4);
d3 = wrcoef('d',c,l,'db5',3);
d2 = wrcoef('d',c,l,'db5',2);
d1 = wrcoef('d',c,l,'db5',1);
%重构1~4层近似函数

a4 = wrcoef('a',c,l,'db5',4);
a3 = wrcoef('a',c,l,'db5',3);
a2 = wrcoef('a',c,l,'db5',2);
a1 = wrcoef('a',c,l,'db5',1);

figure(4)

subplot(811)
plot(a1)
title('小波变换')
subplot(812)
plot(d1)
subplot(813)
plot(a2)
subplot(814)
plot(d2)
subplot(815)
plot(a3)
subplot(816)
plot(d3)
subplot(817)
plot(a4)
subplot(818)
plot(d4)


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global s1;
global fs1;
[imf,residual,info] = emd(s1,'Interpolation','pchip');

三、运行结果







四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.
[4]全雪峰,黄文海,常梦星.可视化心音诊断教学系统设计[J].工业控制计算机. 2012,25(12)

以上是关于求基于matlab的EMD代码,急!的主要内容,如果未能解决你的问题,请参考以下文章

LSTM时序预测基于matlab EMD结合LSTM风速数据预测含Matlab源码 2051期

LSTM时序预测基于matlab EMD结合LSTM风速数据预测含Matlab源码 2051期

优化预测基于matlab EMD优化SVR数据预测含Matlab源码 1403期

心音信号基于matlab GUI EMD心音信号特征提取含Matlab源码 1735期

风速预测基于matlab EMD+模拟退火算法优化DBN风速预测含Matlab源码 JQ003期

求MATLAB求信噪比的方法~急急急~!