肌电信号脉搏信号分析(去噪+特征提取)matlab 源码含GUI
Posted Matlab咨询QQ1575304183
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了肌电信号脉搏信号分析(去噪+特征提取)matlab 源码含GUI相关的知识,希望对你有一定的参考价值。
一、简介
EMG,应用电子学仪器记录肌肉静止或收缩时的电活动,及应用电刺激检查神经、肌肉兴奋及传导功能的方法。英文简称EMG。通过此检查可以确定周围神经、神经元、神经肌肉接头及肌肉本身的功能状态。
通过测定运动单位电位的时限、波幅,安静情况下有无自发的电活动,以及肌肉大力收缩的波型及波幅,可区别神经原性损害和肌原性损害,诊断脊髓前角急、慢性损害(如脊髓前灰质炎、运动神经元疾病),神经根及周围神经病变(例如肌电图检查可以协助确定神经损伤的部位、程度、范围和预后)。另外对神经嵌压性病变、神经炎、遗传代谢障碍神经病、各种肌肉病也有诊断价值。此外,肌电图还用于在各种疾病的治疗过程中追踪疾病的恢复过程及疗效。
利用计算机技术,可作肌电图的自动分析,如解析肌电图、单纤维肌电图以及巨肌电图等,提高诊断的阳性率。
肌电图检查多用针电极及应用电刺激技术,检查过程中有一定的痛苦及损伤 ,因此除非必要 ,不可滥用此项检查。另外,检查时要求肌肉能完全放松或作不同程度的用力,因而要求受检者充分合作。对于某些检查,检查前要停药,如新斯地明类药物应于检查前16小时停用
记录肌肉动作电位的曲线(电描记图)称为肌电图。缩写为EMG。实际使用的描记方法有两种:一种是表面导出法,即把电极贴附在皮肤上导出电位的方法;另一种是针电极法,即把针电极刺入肌肉导出局部电位的方法。用后一种方法能分别记录肌肉每次的动作电位,而根据从每秒数次到二、三十次的肌肉动作电位情况,发现频率的异常。应用肌电图还可以诊断运动机能失常的原因。平常所用的针电极称为同心电极,它是把细针状电极穿过注射针的中心,两者绝缘固定制成的。
二、源代码
%% Program Start
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 名称:信号处理课程设计
%% 功能:脉搏检测系统GUI主界面
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
function varargout = mainjiemian(varargin)
% MAINJIEMIAN MATLAB code for mainjiemian.fig
% MAINJIEMIAN, by itself, creates a new MAINJIEMIAN or raises the existing
% singleton*.
%
% H = MAINJIEMIAN returns the handle to a new MAINJIEMIAN or the handle to
% the existing singleton*.
%
% MAINJIEMIAN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAINJIEMIAN.M with the given input arguments.
%
% MAINJIEMIAN('Property','Value',...) creates a new MAINJIEMIAN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before mainjiemian_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to mainjiemian_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 mainjiemian
% Last Modified by GUIDE v2.5 29-Apr-2021 12:18:07
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @mainjiemian_OpeningFcn, ...
'gui_OutputFcn', @mainjiemian_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before mainjiemian is made visible.
function mainjiemian_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 mainjiemian (see VARARGIN)
% Choose default command line output for mainjiemian
handles.output = hObject;
ha=axes('units','normalized','position',[0 0 1 1]);
uistack(ha,'down')
II=imread('1.jpg');
image(II)
colormap gray
set(ha,'handlevisibility','off','visible','off');
% Update handles structure
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes mainjiemian wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = mainjiemian_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
varargout{1} = handles.output;
% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
untitled;
% hObject handle to togglebutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton1
% --- Executes on button press in togglebutton2.
function togglebutton2_Callback(hObject, eventdata, handles)
yuchuli;
% hObject handle to togglebutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton2
% --- Executes on button press in togglebutton3.
function togglebutton3_Callback(hObject, eventdata, handles)
tezheng;
% hObject handle to togglebutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton3
% --- Executes when figure1 is resized.
function figure1_SizeChangedFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before jidian is made visible.
function jidian_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 jidian (see VARARGIN)
% Choose default command line output for jidian
handles.output = hObject;
ha=axes('units','normalized','position',[0 0 1 1]);
uistack(ha,'down')
II=imread('666.jpg');
image(II)
colormap gray
set(ha,'handlevisibility','off','visible','off');
axes(handles.axes1);
axes(handles.axes2);
axes(handles.axes3);
axes(handles.axes4);
axes(handles.axes5);
axes(handles.axes6);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jidian wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = jidian_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
varargout{1} = handles.output;
% --- Executes when figure1 is resized.
function figure1_SizeChangedFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
%%%%%把代码放到这,运行时自动加载
[filename,filepath]=uigetfile('C:\\Users\\dell\\Desktop\\信号处理课设-----杨硕\\初始脉搏数据\\MaiBobefore.txt');
filename=[filepath,filename];
[t,Pluse_pre]=textread(filename,'%f%f','headerlines',1);%读入2个浮点值,并跳过文档的第1行
[m,n]=size(Pluse_pre);
n=3;
s3=Pluse_pre;
%%%%%%%%%%%%—————提取2000个点进行数据处理——————%%%%%%%%%%%%%%%%%%%%
fs=360;%采样率
x0=s3(1:2000);%取1到2000共2000个点
t=1:length(x0);%length(x0)指x0数组元素的个数
axes(handles.axes1);
plot(t,x0)
xlabel('采样点');
ylabel('magtitude');
title('标准脉搏信号')
box1=msgbox('正在加载请稍候','提示');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%初步去除基线漂移%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%中值滤波%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L1=medfilt1(x0,330); %一维中值滤波,x0为数组,即要处理原始波形,n是中值滤波器的参数,L1是滤波以后的结果(数组)
L2=x0-L1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%频谱%%%%%%%%%%%%%%%%%%%%%%%%
N=length(x0);%样点个数
df=fs/(N-1);%分辨率
f=(0:N-1)*df;%其中每点的频率
Y=fft(L2(1:N))/N*2;%真实的幅值
axes(handles.axes2);
plot(f(1:N/2),abs(Y(1:N/2)));%傅里叶变换后的频谱图是对称的,这里需要一半就可以了
xlabel('频率/Hz');
ylabel('振幅');
axis ( [0 100 0 0.4] );
title('中值滤波后脉搏信号频率谱')
drawnow;
三、运行结果
四、备注
版本:2014a
以上是关于肌电信号脉搏信号分析(去噪+特征提取)matlab 源码含GUI的主要内容,如果未能解决你的问题,请参考以下文章
肌电信号脉搏信号分析(去噪+特征提取)matlab源码含GUI