【肌电信号】基于matlab GUI肌电信号处理【含Matlab源码 966期】

一、简介

肌电信号又称为EMG;EMG(electromyography)是一种生物电流信号,它产生于任意组织器官,一般是一种时间和一系列的振幅、频率和波形函数 。肌电信号是伴随肌肉收缩动作产生的一种生物电信号,采集皮肤表面的肌电信号称为表面肌电信号sEMG。
sEMG信号是人体表面肌肉通过收缩产生的生物电流。 神经系统控制肌肉的活动(收缩或者放松),在表面皮肤不同的肌肉纤维运动单元在同一时间产生相互不同的信号。

肌电信号的产生
表面肌电信号是由多个运动单元发放的动作电位序列,在皮肤表面呈现的时间和空间上综合叠加的结果;
【肌电信号】基于matlab GUI肌电信号处理【含Matlab源码 966期】_第1张图片
【肌电信号】基于matlab GUI肌电信号处理【含Matlab源码 966期】_第2张图片
肌电信号的特点
(1)sEMG是一维时间动作电位序列
(2)sEMG是交流信号,幅值一般和肌肉运 动力度成正比
(3)sEMG是一种非平稳的微电信号,其幅值在 0~1.5mv,有用信号频率位于 0~500HZ,主要能量集中在 20~150HZ
(4)SEMG一般比肢体运动超前 30~150ms产生,可以进行运动提前判断

二、源代码

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 EDIT
gui_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 bishe1
handles.output = hObject;

% Update handles structure
guidata(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 structure
varargout{
     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);
end
fs=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);
end
fs=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);
end
fs=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);
end
fs=1;                          %采样频率
N=5000;                            %采样点数
n=0:N-1;
t=n/fs;                           %时间
sfft=fft(s);  %傅里叶变换
sF=s;

三、运行结果

【肌电信号】基于matlab GUI肌电信号处理【含Matlab源码 966期】_第3张图片

四、备注

版本:2014a

你可能感兴趣的:(matlab,信号处理)