【肌电信号】肌电信号处理系统含Matlab源码

2022/2/28 22:22:17

本文主要是介绍【肌电信号】肌电信号处理系统含Matlab源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1 简介

研究目的通过使用Matlab平台,实现运动生物力学研究中常用的表面肌电(s EMG)信号处理方法,为不会使用编程进行表面肌电(s EMG)信号数据处理的体育科研人员在表面肌电(s EMG)信号的处理过程中提供一个高效、简单的处理软件。研究方法通过对运动人体科学文献中常用的表面肌电信号(s EMG)处理方法进行总结,并获取进行表面肌电信号处理时常用的处理方法的算法,然后利用Matlab编程语言对各处理方法进行实现,并且实现为交互式的GUI软件。通过与现有商用软件处理结果的比较,对实现的各方法在数据处理过程中的准确性进行验证。然后将其应用到实验室的表面肌电(s EMG)信号数据处理当中,通过招募无编程基础的人员使用实验室的商业软件和本软件分别进行相同的数据处理过程,比较两者的效率。结果Matlab编写完成了一套涵盖表面肌电信号(s EMG)在体育科学研究中处理基本功能的软件。除了包含现有商业软件实现的处理功能外,还包括一些体育研究中未使用,而在其他领域使用的信号降噪方法,以及指标提取方法。该软件涵盖了传统表面肌电s EMG信号处理过程中常用的信号处理函数,主要包括预处理、指标提取和统计分析等函数;预处理主要是进行降噪处理和指标提取前的数据准备;指标提取包括时域、频域、时频特征指标提取;以及后期对指标的部分整合处理函数。​

2 部分代码

function varargout = bishe1(varargin)% BISHE1 MATLAB code for bishe1.fig%      BISHE1, by itself, creates a new BISHE1 or raises the existing%      singleton*.%%      H = BISHE1 returns the handle to a new BISHE1 or the handle to%      the existing singleton*.%%      BISHE1('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in BISHE1.M with the given input arguments.%%      BISHE1('Property','Value',...) creates a new BISHE1 or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before bishe1_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to bishe1_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 bishe1% Last Modified by GUIDE v2.5 25-May-2021 12:43:46% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @bishe1_OpeningFcn, ...                   'gui_OutputFcn',  @bishe1_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 bishe1 is made visible.function bishe1_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 bishe1 (see VARARGIN)% Choose default command line output for bishe1handles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes bishe1 wait for user response (see UIRESUME)% uiwait(handles.figure1);​% --- Outputs from this function are returned to the command line.function varargout = bishe1_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 structurevarargout{1} = handles.output;​% --- Executes during object creation, after setting all properties.function axes2_CreateFcn(hObject, eventdata, handles)% hObject    handle to axes2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes2​% --- Executes during object creation, after setting all properties.function axes1_CreateFcn(hObject, eventdata, handles)% hObject    handle to axes1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes1​% --- Executes during object creation, after setting all properties.function axes3_CreateFcn(hObject, eventdata, handles)% hObject    handle to axes3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes3​% --- Executes during object creation, after setting all properties.function axes4_CreateFcn(hObject, eventdata, handles)% hObject    handle to axes4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes4​% --- Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)selection=questdlg(['是否关闭',get(gcf,'Name'),'这个面板?'], ...     ['Close ',get(gcf,'Name'),'...'],'是','否','是');%当选择退出按钮时,得出一个问是否确定关闭的框if strcmp(selection,'否')    return;                                    else      clc;    %当选择关闭时,清空所有matla输入面上的所有错误信息,同时关闭图像窗口    clear all;    delete(gcf);    end% --- 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)A=load('1.txt');global Q;switch Q    case 1        s=A(30001:35000,2);    case 2        s=A(35001:40000,2);    case 3        s=A(40001:45000,2);    case 4        s=A(45001:50000,2);    case 5        s=A(50001:55000,2);    case 6        s=A(55001:60000,2);endfs=1;                                                  %采样频率N=5000;                                                %采样点数n=0:N-1;t=n/fs;                                                %时间axes(handles.axes1);plot(t,s);title('输入信号');xlabel('t/s');ylabel('幅度');         %时域波形grid on   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)A=load('1.txt');global Q;switch Q    case 1        s=A(30001:35000,2);    case 2        s=A(35001:40000,2);    case 3        s=A(40001:45000,2);    case 4        s=A(45001:50000,2);    case 5        s=A(50001:55000,2);    case 6        s=A(55001:60000,2);endfs=1;                               %采样频率N=5000;                             %采样点数n=0:N-1;t=n/fs;                             %时间sfft=fft(s);                        %傅里叶变换axes(handles.axes2);plot((1:length(sfft)/2)*fs/length(sfft),2*abs(sfft(1:length(sfft)/2))/length(sfft));  title('信号频谱');xlabel('频率/Hz');ylabel('幅度');grid on                             %未滤波时  频域波形% --- 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)A=load('1.txt');global Q;switch Q    case 1        s=A(30001:35000,2);    case 2        s=A(35001:40000,2);    case 3        s=A(40001:45000,2);    case 4        s=A(45001:50000,2);    case 5        s=A(50001:55000,2);    case 6        s=A(55001:60000,2);endfs=1;                               %采样频率N=5000;                            %采样点数n=0:N-1;t=n/fs;                             %时间  axes(handles.axes3);c = rceps(s);                       %做倒谱图plot(t,c);title('信号倒谱');xlabel('频率/Hz');ylabel('幅度');grid on   % --- Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)A=load('1.txt');global Q;switch Q    case 1        s=A(30001:35000,2);    case 2        s=A(35001:40000,2);    case 3        s=A(40001:45000,2);    case 4        s=A(45001:50000,2);    case 5        s=A(50001:55000,2);    case 6        s=A(55001:60000,2);endfs=1;                          %采样频率N=5000;                            %采样点数n=0:N-1;t=n/fs;                           %时间sfft=fft(s);  %傅里叶变换sF=s;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%频域特征值计算%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%L1=length(sF);cx1=xcorr(sF,'unbiased');cxk1=fft(cx1,L1);px1=abs(cxk1);                                                 %求功率谱密度pxx1=10*log10(px1);f1=(0:L1-1)*fs/L1;axes(handles.axes4);plot(f1(1:L1/2),pxx1(1:L1/2))xlabel('频率/Hz');ylabel('功率谱/dB');title('平均功率谱图');grid on                                                        %做功率谱图function edit1_Callback(hObject, eventdata, handles)% hObject    handle to edit1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text%        str2double(get(hObject,'String')) returns contents of edit1 as a double​% --- Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit2_Callback(hObject, eventdata, handles)% hObject    handle to edit2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text%        str2double(get(hObject,'String')) returns contents of edit2 as a double​% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit3_Callback(hObject, eventdata, handles)% hObject    handle to edit3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text%        str2double(get(hObject,'String')) returns contents of edit3 as a double​% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit4_Callback(hObject, eventdata, handles)% hObject    handle to edit4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit4 as text%        str2double(get(hObject,'String')) returns contents of edit4 as a double​% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit5_Callback(hObject, eventdata, handles)% hObject    handle to edit5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit5 as text%        str2double(get(hObject,'String')) returns contents of edit5 as a double​% --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit6_Callback(hObject, eventdata, handles)% hObject    handle to edit6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)​​​% --------------------------------------------------------------------function Untitled_1_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Q;Q=1;% --------------------------------------------------------------------function Untitled_2_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLABglobal Q;Q=2;% --------------------------------------------------------------------function Untitled_3_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Q;Q=3;% --------------------------------------------------------------------function Untitled_4_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Q;Q=4;% --------------------------------------------------------------------function Untitled_5_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Q;Q=5;% --------------------------------------------------------------------function Untitled_6_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Q;Q=6;​function pushbutton7_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton7 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)x1=1:1:6;y1=[0.0425,0.0599,0.0689,0.0813,0.0709,0.0637];[p1 s1]=polyfit(x1,y1,4);q1=linspace(1,6,100);z1=polyval(p1,q1); %多项式求值axes(handles.axes5);plot(x1,y1,'o',q1,z1,'k:',x1,y1,'k')ylabel('MF的大小');xlabel('时间段');legend({'原始数据','4阶曲线'},'FontSize',8,'Location','Northwest')s1% --- Executes on button press in pushbutton8.function pushbutton8_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton8 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)x2=1:1:6;y2=[0.0295,0.0634,0.0976,0.1263,0.1120,0.0683];[p2 s2]=polyfit(x2,y2,4);q2=linspace(1,6,100);z2=polyval(p2,q2); %多项式求值axes(handles.axes6);plot(x2,y2,'*',q2,z2,'r',x2,y2,'r')ylabel('MPF的大小');xlabel('时间段');legend({'原始数据','4阶曲线'},'FontSize',8,'Location','Northwest')s2​​function edit7_Callback(hObject, eventdata, handles)% hObject    handle to edit7 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit7 as text%        str2double(get(hObject,'String')) returns contents of edit7 as a double​% --- Executes during object creation, after setting all properties.function edit7_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit7 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​​​function edit8_Callback(hObject, eventdata, handles)% hObject    handle to edit8 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit8 as text%        str2double(get(hObject,'String')) returns contents of edit8 as a double% --- Executes during object creation, after setting all properties.function edit8_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit8 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end​

3 仿真结果

4 参考文献

[1]李向明. 基于Matlab的表面肌电信号处理软件设计与开发[D]. 上海体育学院.

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

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



这篇关于【肌电信号】肌电信号处理系统含Matlab源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程