版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、基于matlab的肌电信号处理程序:function varargout = untitled(varargin)% untitled m-file for untitled.fig% untitled, by itself, creates a new untitled or raises the existing% singleton*.% h = untitled returns the handle to a new untitled or the handle to% the existing singleton*.% untitled(callback,hobject,eventd
2、ata,handles,.) calls the local% function named callback in untitled.m with the given input arguments.% untitled(property,value,.) creates a new untitled or raises the% existing singleton*. starting from the left, property value pairs are% applied to the gui before untitled_openingfcn gets called. an
3、% unrecognized property name or invalid value makes property application% stop. all inputs are passed to untitled_openingfcn via varargin.% *see gui options on guides tools menu. choose gui allows only one% instance to run (singleton).% see also: guide, guidata, guihandles % edit the above text to m
4、odify the response to help untitled % last modified by guide v2.5 08-nov-2014 12:45:18 % begin initialization code - do not editgui_singleton = 1;gui_state = struct(gui_name, mfilename, . gui_singleton, gui_singleton, . gui_openingfcn, untitled_openingfcn, . gui_outputfcn, untitled_outputfcn, . gui_
5、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 untitled is made
6、visible.function untitled_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
7、 arguments to untitled (see varargin) % choose default command line output for untitledhandles.output = hobject; % update handles structureguidata(hobject, handles); % uiwait makes untitled wait for user response (see uiresume)% uiwait(handles.figure1); % - outputs from this function are returned to
8、 the command line.function varargout = untitled_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 guid
9、ata) % get default command line output from handles structurevarargout1 = 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
10、% handles structure with handles and user data (see guidata)global s;global a;global t;global count;% count=1;filename,filepath=uigetfile(*.txt,);% str=filepath filename; s=load(str); a=s(:,7); t=s(:,1); axes(handles.axes1);plot(t,a);xlabel();ylabel();title(); if count=2 global s2;global a2;global t
11、2; filename,filepath=uigetfile(*.txt,); str=filepath filename; s2=load(str); a2=s2(:,7); t2=s2(:,1); plot(handles.axes2,t2,a2); end count=1; % - executes on button press in pushbutton2.function pushbutton2_callback(hobject, eventdata, handles)% hobject handle to pushbutton2 (see gcbo)% eventdata res
12、erved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)global a;global t;global s;global y; % global ir;% global sorh;y=fft(a,20000);m =length (a) ;n=length(y);p=size(a);% s1=a(1:20000);c l=wavedec(a,3,db5);ca3=appcoef(c,l,db5,3);cd1=detcoef(c,
13、l,1);cd2=detcoef(c,l,2);cd3=detcoef(c,l,3);thr1=thselect(cd1,rigrsure);thr2=thselect(cd2,rigrsure);thr3=thselect(cd3,rigrsure);tr=thr1,thr2,thr3;sorh=s;xc,cxc,lxc,perfo,perf2=wdencmp(lvd,a,. db5,3,tr,sorh);l=p(2);x=a;h=xc;f=0;m=0;for ii=1:l m(ii)=(x(ii)-y(ii)2; t(ii)=y(ii)2; f(ii)=t(ii)/m(ii); f=f+f
14、(ii); m=m+m(ii);end;snr=10*log10(f);mse=m/n;sm=snr/mse;axes(handles.axes2);plot(xc(1:10000);xlabel();ylabel();title();% plot(handles.axes2,xc(1:20000); % - executes on button press in pushbutton3.function pushbutton3_callback(hobject, eventdata, handles)% hobject handle to pushbutton3 (see gcbo)% ev
15、entdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)global a;global t;global y;global count;%a=emg3(1:points,2);y=fft(a,20000); %fourierfs=2000;n=length(y);mag=abs(y);%fourierf=(0:n-1)/n*fs; %axes(handles.axes1);plot(f,mag);% plot
16、(handles.axes1,f,mag);% xlabel();ylabel();title(n=20000);if count=2global a2;global t2;global y2; %a=emg3(1:points,2);y2=fft(a2,20000); %fourierfs=2000;n=length(y2);mag=abs(y2);%fourierf=(0:n-1)/n*fs; %axes(handles.axes2);plot(f,mag); endcount=1; % - executes on button press in pushbutton4.function
17、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 a;global t;% global ir;% global sorh;c l=wavedec(a,3,db5);ca3=appcoef(c,l,db
18、5,3);cd1=detcoef(c,l,1);cd2=detcoef(c,l,2);cd3=detcoef(c,l,3);thr1=thselect(cd1,rigrsure);thr2=thselect(cd2,rigrsure);thr3=thselect(cd3,rigrsure);tr=thr1,thr2,thr3;sorh=s;xc,cxc,lxc,perfo,perf2=wdencmp(lvd,a,. db5,3,tr,sorh);y1=fft(xc,20000);fs=2000;n=length(y1);mag1=abs(y1);f=(0:n-1)/n*fs;axes(hand
19、les.axes2);plot(f,mag1);xlabel();ylabel();title(n=20000); % - 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
20、 and user data (see guidata)global a;global t;global y;global count;fs=2000;n=length(y);f=(0:n-1)/n*fs;%axes(handles.axes1);plot(f,angle(y);xlabel();ylabel();title();% plot(handles.axes1,f,angle(y);%if count=2global a2;global t2;global y2;fs=2000;n=length(y2);f=(0:n-1)/n*fs;%axes(handles.axes2);plot
21、(f,angle(y2);xlabel();ylabel();title();endcount=1;% plot(handles.axes1,f,angle(y);% % - 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% hand
22、les structure with handles and user data (see guidata)global a;global t;c l=wavedec(a,3,db5);ca3=appcoef(c,l,db5,3);cd1=detcoef(c,l,1);cd2=detcoef(c,l,2);cd3=detcoef(c,l,3);thr1=thselect(cd1,rigrsure);thr2=thselect(cd2,rigrsure);thr3=thselect(cd3,rigrsure);tr=thr1,thr2,thr3;sorh=s;xc,cxc,lxc,perfo,p
23、erf2=wdencmp(lvd,a,. db5,3,tr,sorh);y1=fft(xc,20000);fs=2000;n=length(y1);f=(0:n-1)/n*fs;axes(handles.axes2);plot(f,angle(y1);xlabel();ylabel();title(); % - executes on button press in pushbutton7.function pushbutton7_callback(hobject, eventdata, handles)% hobject handle to pushbutton7 (see gcbo)% e
24、ventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)try delete(allchild(handles.axes1); delete(allchild(handles.axes2); set(handles.edit1,string,); set(handles.edit1,string,); set(handles.edit3,string,); set(handles.edit4,string,
25、); set(handles.edit5,string,); set(handles.edit6,string,); end % - 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 ha
26、ndles and user data (see guidata)global a;global t;global s;y=fft(a,20000);fs=2000;n=length(y);mag=abs(y);f=(0:n-1)/n*fs;power1=(mag.2)/20000;axes(handles.axes1);plot(f,power1);xlabel();ylabel();title();global count;global a2;global t2;global s2;if count=2y2=fft(a2,20000);fs=2000;n=length(y2);mag=ab
27、s(y2);f=(0:n-1)/n*fs;power1=(mag.2)/20000;axes(handles.axes2);plot(f,power1);xlabel();ylabel();title();endcount=1; % - executes on button press in pushbutton9.function pushbutton9_callback(hobject, eventdata, handles)% hobject handle to pushbutton9 (see gcbo)% eventdata reserved - to be defined in a
28、 future version of matlab% handles structure with handles and user data (see guidata)global a;global t;global s;s=fft(a,2000);c l=wavedec(a,3,db5);ca3=appcoef(c,l,db5,3);cd1=detcoef(c,l,1);cd2=detcoef(c,l,2);cd3=detcoef(c,l,3);thr1=thselect(cd1,rigrsure);thr2=thselect(cd2,rigrsure);thr3=thselect(cd3
29、,rigrsure);tr=thr1,thr2,thr3;sorh=s;xc,cxc,lxc,perfo,perf2=wdencmp(lvd,a,. db5,3,tr,sorh);y1=fft(xc,20000);fs=2000;n=length(y1);mag=abs(y1);f=(0:n-1)/n*fs;power1=(mag.2)/20000;%axes(handles.axes2);plot(f,power1);xlabel();ylabel();title(); % - executes on button press in pushbutton10.function pushbut
30、ton10_callback(hobject, eventdata, handles)% hobject handle to pushbutton10 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)%global a; set(handles.edit1,string,mean(a); function edit1_callback(hobject, eventdata,
31、 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 do
32、uble % - 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 %
33、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 % - executes on button press in pushbutton11.function pushbutton11_callback(hobject, ev
34、entdata, handles)% hobject handle to pushbutton11 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)global a; set(handles.edit3,string,sqrt(var(a); function edit3_callback(hobject, eventdata, handles)% hobject hand
35、le 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 durin
36、g 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 usu
37、ally have a white background on windows.% see ispc and computer.if ispc & isequal(get(hobject,backgroundcolor), get(0,defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor,white);end % - executes on button press in pushbutton12.function pushbutton12_callback(hobject, eventdata, handles)% hobj
38、ect handle to pushbutton12 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)global a;set(handles.edit4,string,var(a); function edit4_callback(hobject, eventdata, handles)% hobject handle to edit4 (see gcbo)% event
39、data 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 sett
40、ing 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
41、on windows.% see ispc and computer.if ispc & isequal(get(hobject,backgroundcolor), get(0,defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor,white);end % - executes on button press in pushbutton13.function pushbutton13_callback(hobject, eventdata, handles)% hobject handle to pushbutton13 (s
42、ee gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)%iemgglobal a;set(handles.edit5,string,mean(abs(a); function edit5_callback(hobject, eventdata, handles)% hobject handle to edit5 (see gcbo)% eventdata reserved - to
43、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.
44、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 is
45、pc and computer.if ispc & isequal(get(hobject,backgroundcolor), get(0,defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor,white);end % - executes on button press in pushbutton14.function pushbutton14_callback(hobject, eventdata, handles)% hobject handle to pushbutton14 (see gcbo)% eventdata
46、 reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)%rmsglobal a;set(handles.edit6,string,sqrt(mean(a.2); function edit6_callback(hobject, eventdata, handles)% hobject handle to edit6 (see gcbo)% eventdata reserved - to be defined in a f
47、uture version of matlab% handles structure with handles and user data (see guidata) % hints: get(hobject,string) returns contents of edit6 as text% str2double(get(hobject,string) returns contents of edit6 as a double % - executes during object creation, after setting all properties.function edit6_cr
48、eatefcn(hobject, eventdata, handles)% hobject handle to edit6 (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.i
49、f ispc & isequal(get(hobject,backgroundcolor), get(0,defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor,white);end % - executes on button press in pushbutton15.function pushbutton15_callback(hobject, eventdata, handles)% hobject handle to pushbutton15 (see gcbo)% eventdata reserved - to be
50、 defined in a future version of matlab% handles structure with handles and user data (see guidata)global a;global t;global s;y=fft(a,20000);fs=2000;n=length(y);mag=abs(y);f=(0:n-1)/n*fs;power1=(mag.2)/20000;ss=sum(power1);m2=0.5*ss;df=fs/n;m1=0.5*df*(sum(power1(1:n-1)+sum(power1(2:n);mpf=m1/m2;set(h
51、andles.edit7,string,mpf);function edit7_callback(hobject, eventdata, handles) 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, eventdat
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度水性涂料生产与销售合作协议3篇
- 2025年度知识产权许可合同的执行细则6篇
- 家庭厨房装修设计与健康生活理念结合
- 2025年度茶叶大宗购销合作合同(仙毫茶专供)
- 多学科混合型实验楼的建设策略及前期工作指导
- 二零二五年度室内篮球场恒温恒湿施工与体育设备配套合同3篇
- 二零二五年度跨境电商货物保险合同规范范本3篇
- 实验室数据安全与隐私保护的信息化管理
- 个人短期租车协议范例2024年版版B版
- 2024高效软件销售协议模板汇编版B版
- 建筑智能化项目系统试运行记录表
- 三年级上册寒假每日一练
- (正式版)SHT 3115-2024 石油化工管式炉轻质浇注料衬里工程技术规范
- 重庆工作报告
- 教科版科学四年级下册第二单元《电路》教学计划
- 无人机驾驶员航空知识手册培训教材(多旋翼)
- 天津市部分区2023-2024学年六年级上学期期末数学试卷
- 员工年度工作计划范文
- 洗衣店行业创业计划书
- 医院规划发展部社会工作科职责
- 2024抗菌药物分级管理及临床合理应用考核试题及答案
评论
0/150
提交评论