资源简介
matlab开发-EMGONOFF。找到“开”和“关”表示一个原始表面肌电爆发(肌肉收缩)。
代码片段和文件信息
function onoff = emgonoff(rawemg fs ws sd)
% EMGONOFF - Find on/off times and indicies of raw EMG data.
% Calculate average(mean) value of resting EMG
% Define “on“ EMG as the sample where average value of EMG in a given window
% range around the sample is a given # of std. dev. above avg. resting EMG.
%
% onoff = emgonoff(rawemg fs ws sd)
%
% Use the mouse to select two ranges of “resting“ EMG from a graph of the
% full-wave rectified EMG data. Click four times: start and end of 1st
% resting range and start and end of 2nd resting range. Mouse clicks need
% to be consecutive and in order of increasing time (i.e. left-to-right on
% the graph). The first range should precede the EMG burst associated with
% the muscle contraction under consideration. The sedond range should be
% the resting EMG data immediately following the EMG burst.
%
% rawemg = input file raw emg data (1-column vector)
% fs = sampling rate of raw EMG data in Hz
% ws = window size in milliseconds (50ms @ 2400Hz = 120 samples)
% sd = number of std. deviations above resting rms emg to trigger an “ON“
% Default values:
% ws = 50ms
% sd = 1
% Algorythm for EMG onset & offset taken from
% Hodges P.W. and B.H. Bui _A comparison of computer-based methods for
% the determination of onset of muscle contraction using electromyography._
% Electroencephalography & Clinical Neurophysiology 1996. 101(6): p. 511-9
%
% Created by: Kieran A. Coghlan BSME MSES
% SUNY at Buffalo New York
%
% Last modified: 1 May 2006
%% Check inputs for defaults
if nargin < 2 error(‘Not enough inputs. Type “help emgonoff“ for help.‘); end
if nargin < 3 ws = 50; end
if nargin < 4 sd = 1; end;
%% Full-Wave-Rectify the raw data
fwlo = abs(rawemg(:1));
%% prepare for loop
% Get two ranges for resting emg (before & after burst) using ginput
R = input(‘\nUse the mouse to select FOUR points to define the begining and \nend of two data ranges that will be used to calculate average\nresting EMG values before and after the EMG burst (muscle contraction)\nPress [RETURN] to begin: ‘);
clear R;
f1 = figure;
plot(fwlo);
[x y] = ginput(4); %click four times: two for start/end of resting emg before burst two for resting emg after burst
x = round(x);
clear y;
%close(f1);clear f1; % Leave commented if you want to keep EMG graph up to
% % do a visual QA of on/off results.
%% preallocate arrays
mvgav = zeros(x(4)-x(1)1);
onoff(11) = 0;
i=0;
restav = mean(fwlo(x(1):x(2))); %average value of rest EMG before ON
reststd = std(fwlo(x(1):x(2))); %std. dev. of rest EMG before ON
restav2 = mean(fwlo(x(3):x(4))); %average value of rest EMG after OFF
reststd2 = std(fwlo(x(3):x(4))); %std. dev. of rest EMG after OFF
%% window size (in samples) = ws*fs e.g. 50ms*2400Hz = 120 samples
sws2 = fs*(0.001*ws);
sws = 0.5*(sws2);
sws = round(sws);
%% find “ON“ index:
% for xi change from x(1) to x(2) if you want to 属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3677 2018-07-11 20:24 emgonoff.m
- 上一篇:matlab开发-MeshLBP
- 下一篇:matlab开发-othellom
相关资源
- matlab开发-能带计算
- matlab开发-FlockingAlgorithm
- matlab开发-MuellerStokesJonesCalculus
- matlab开发-HX711的自定义数据库
- matlab开发-SMOTEBoost
- matlab开发-果蝇优化算法第二版
- matlab开发-多变量决策树
- matlab开发-水轮发电机模型
- matlab开发-交通警告标志识别标签代码
- matlab开发-RUSBoost
- matlab开发-基于遗传算法的机器人运动
- matlab开发-MPU6050加速度陀螺仪
- matlab开发-功率曲线FAsmallscalewindturbi
- matlab开发-NASAJPLDE405开发星历表
- matlab开发-SortinoRatio
- matlab开发-永磁TDC并联电机数学模型
- matlab开发-3相SPWM整流器
- matlab开发-Kilobotswarm控制Matlabarduino
- matlab开发-简单音频播放
- matlab开发-记录文件的绘图仪加速度、
- matlab开发-永磁同步电机PMSM动态数学模
- matlab开发-多目标优化差分进化算法
- matlab开发-随机微分方程解算
- matlab开发-波长调制光谱的二次谐波模
- matlab开发-仿制药生物生理学基础药动
- matlab开发-使用svmrfe选择功能
- matlab开发-KDTreeNearestNeighborandRangeSear
- matlab开发-stlread
- matlab开发-三维图像堆栈查看器
- matlab开发-动态电压恢复器故障dvr
川公网安备 51152502000135号
评论
共有 条评论