版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、基于matlab的肌電信號處理程序:作者:日期:基于matlab的肌電信號處理程序:function varargout = un titled(vararg in)% UNTITLED M-file for un titled.fig% UNTITLED, by itself, creates a new UNTITLED or raises the exist ing%sin glet on*.% H = UNTITLED returns the han dle to a new UNTITLED or the han dle to%the existi ng sin glet on*.%
2、UNTITLED('CALLBACK',hObject,eve ntData,ha ndles,.) calls the local%fun ctio n named CALLBACK in UNTITLED.M with the give n in put argume nts.% UNTITLED('Property','Value',.) creates a new UNTITLED or raises the% existi ng sin glet on*. Starting from the left, property value p
3、airs are%applied to the GUI before un titled_Ope nin gFc n gets called. An%un recog ni zed property n ame or in valid value makes property applicati on% stop. All in puts are passed to un titled_Ope nin gFc n via vararg in.%*See GUI Optio ns on GUIDE's Tools me nu. Choose "GUI allows only o
4、ne%in sta nee to run (sin glet on)".% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the resp onse to help un titled% Last Modified by GUIDE v2.5 08-Nov-2014 12:45:18% Begin initialization code - DO NOT EDITgui_S in glet on = 1;gui_State = struct('gui_Name', mfile n
5、ame, .'gui_S in glet on', gui_S in glet on, .'gui_Ope nin gFc n', un titled_Ope nin gFc n,.'gui_OutputFcn', un titled_OutputFcn, .'gui_LayoutFc n',.'gui_Callback', );if nargin && ischar(varargin1)gui_State.gui_Callback = str2fu nc(vararg in 1);endif n
6、argoutvarargout1: nargout = gui_ma infcn( gui_State, vararg in :);elsegui_ma infcn( gui_State, vararg in :);end% End initialization code - DO NOT EDIT% - Executes just before un titled is made visible.function un titled_Ope nin gFc n( hObject, even tdata, han dles, vararg in)% This fun cti on has no
7、 output args, see OutputFc n.% hObject han dle to figure% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUIDATA)% varargin comma nd line argume nts to un titled (see VARARGIN)% Choose default comma nd line output for un titled
8、han dles.output = hObject;% Update han dles structure guidata(hObject, han dles);% UIWAIT makes un titled wait for user respo nse (see UIRESUME)% uiwait(ha ndles.figure1);% - Outputs from this fun ctio n are returned to the comma nd line, function varargout = un titled_OutputFc n( hObject, even tdat
9、a, han dles) % varargout cell array for retur ning output args (see VARARGOUT);% hObject han dle to figure% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUIDATA)% Get default comma nd line output from han dles structure varar
10、gout1 = han dles.output;% - Executes on butt on press in pushbutt on1.function pushbutt on 1_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on1 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUI
11、DATA) global s;global a;global t;global count;% cou nt=1;filename,filepath=uigetfile('*.txt','?t');%?e y?Y?tstr=filepath file name;s=load(str);a=s(:,7);t=s(:,1);axes(ha ndles.axesl);plot(t,a);xlabel(' e± ?');ylabel(' ±?d ?');title('?- e ?D?o?');if co
12、un t=2global s2;global a2;global t2;file name,filepath=uigetfile('*.txt','?t');str=filepath file name;s2=load(str);a2=s2(:,7);t2=s2(:,1);plot(ha ndles.axes2,t2,a2);endcoun t=1;% - Executes on butt on press in pushbutt on2.function pushbutt on 2_Callback(hObject, eve ntdata, han dles)
13、% hObject handle to pushbutt on2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles and user data (see GUIDATA) global a;global t;global s;global y;% global IR;% global SORH;y=fft(a,20000);M =le ngth (a);N=le ngth(y);p=size(a);% s1=a(1:200
14、00);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);thr仁thselect(cD1,'rigrsure');thr2=thselect(cD2,'rigrsure');thr3=thselect(cD3,'rigrsure');TR=thr1,thr2,thr3;SORH='s:XC,CXC,LXC,PERF0,PERF2=wde ncmp
15、('lvd',a,.'db5',3,TR,SORH);L=p(2);x=a;h=XC;F=0;M=0;for ii=1:Lm(ii)=(x(ii)-y(ii)A2;t(ii)=y(ii)A2;f(ii)=t(ii)/m(ii);F=F+f(ii);M=M+m(ii);en d;SNR=10*log10(F);MSE=M/N;SM=SNR/MSE;axes(ha ndles.axes2);plot(XC(1:10000);xlabel(' e± ?');ylabel(' ±?d ?');title(' e
16、¥ ?oo D?o?');% plot(ha ndles.axes2,XC(1:20000);% - Executes on butt on press in pushbutt on3.function pushbutt on 3_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with
17、han dles and user data (see GUIDATA) global a;global t;global y;global count;%a=EMG3(1:poi nts,2);y=fft(a,20000); %?D?o?DD? 1 ?u Fourier ±?fs=2000;N=le ngth(y);mag=abs(y);%?o ?Fourier ± ?oo ? uf=(O:N- 1)/N*fs; %?卩?e DodDaxes(ha ndles.axesl);plot(f,mag);% plot(handles.axes1,f,mag);%?i ?D?xl
18、abel('?卩?e ');yl abel(' u ?叮);title('?-? 卩? u ?卩 N=20000');if coun t=2global a2;global t2;global y2;%a=EMG3(1:poi nts,2);y2=fft(a2,20000); %?D?o?DD? 1 ?u Fourier ±? fs=2000;N=le ngth(y2);mag=abs(y2);%?o ?Fourier ± ?oo ? uf=(0:N- 1)/N*fs; %?卩?e DodDaxes(ha ndles.axes2);p
19、lot(f,mag);endcoun t=1;% - Executes on butt on press in pushbutt on4.function pushbutt on4 _Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles and user data (see GUIDA
20、TA) global a;global t;% global IR;% global SORH;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,thr
21、3;SORH='s'XC,CXC,LXC,PERFO,PERF2=wde ncmp('lvd',a,.'db5',3,TR,SORH);y仁fft(XC,20000);fs=2000;N=le ngth(y1);mag1=abs(y1);f=(0:N-1)/N*fs;axes(ha ndles.axes2);plot(f,mag1);xlabel('?卩?e ');ylabel(' u ?叮);title(' e¥ ?oU ?卩 N=20000');% - Executes on butt on
22、press in pushbutt on5.function pushbutt on 5_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles and user data (see GUIDATA) global a;global t;global y;global count;fs=
23、2000;N=le ngth(y);f=(0:N- 1)/N*fs;%?卩?e DodDaxes(ha ndles.axes1);plot(f,a ngle(y);xlabel('?卩?e '); ylabel(' ?d ?');title('?-? 卩?d ?);% plot(handles.axes1,f,angle(y);%?a ?D?i?if coun t=2global a2;global t2;global y2;fs=2000;N=le ngth(y2);f=(0:N- 1)/N*fs;%?卩?e DodDaxes(ha ndles.axe
24、s2);plot(f,a ngle(y2);xlabel('?卩?e ');ylabel('? a ?');title('?-? 卩?a ?);endcoun t=1;% plot(handles.axes1,f,angle(y);%?a ?D?i?% - Executes on butt on press in pushbutt on6.function pushbutt on 6_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on6 (see GCBO)% ev
25、entdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles 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
26、9;);thr2=thselect(cD2,'rigrsure');thr3=thselect(cD3,'rigrsure');TR=thr1,thr2,thr3;SORH='s:XC,CXC,LXC,PERFO,PERF2=wde ncmp('lvd',a,.'db5',3,TR,SORH);y1=fft(XC,20000);fs=2000;N=le ngth(y1);f=(0:N-1)/N*fs;axes(ha ndles.axes2);plot(f,a ngle(y1);xlabel('?卩?e ')
27、;ylabel('? a ?');title(' e¥ ?oo ?卩?a ?);% - Executes on butt on press in pushbutt on7.function pushbutt on 7_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% han dles structure with
28、han dles and user data (see GUIDATA) trydelete(allchild(ha ndles.axes1);delete(allchild(ha ndles.axes2);set(ha ndles.edit1,'stri ng','');set(ha ndles.edit1,'stri ng',");set(ha ndles.edit3,'stri ng',");set(ha ndles.edit4,'stri ng',");set(ha ndles
29、.edit5,'stri ng',");set(ha ndles.edit6,'stri ng',");end% - Executes on butt on press in pushbutt on8.function pushbutt on 8_Callback(hObject, eve ntdata, han dles)% hObject handle to pushbutt on8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB %
30、 han dles structure with han dles and user data (see GUIDATA) global a;global t;global s;y=fft(a,20000);fs=2000;N=le ngth(y);mag=abs(y);f=(0:N-1)/N*fs;power 仁(mag.A2)/20000;axes(ha ndles.axesl);plot(f,power1);xlabel('?卩?e ');ylabel('1|? e ?x');title('?-? 卩?1|? e ?x ');global
31、count;global a2;global t2;global s2;if coun t=2y2=fft(a2,20000);fs=2000;N=le ngth(y2);mag=abs(y2);f=(0:N-1)/N*fs;power 仁(mag.A2)/20000;axes(ha ndles.axes2);plot(f,power1);xlabel('?卩?e ');ylabel('1|? e ?x');title('?-? 卩?1|? e ?x ');endcoun t=1;% - Executes on butt on press in
32、pushbutt on9.function pushbutt on 9_Callback(hObject, eve ntdata, han dies)% hObject handle to pushbutt on9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dies structure with han dies and user data (see GUIDATA) global a;global t;global s;s=fft(a,2000);C L=wavedec
33、(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,PERF2=wde ncmp('lvd&
34、#39;,a,.'db5',3,TR,SORH);y1=fft(XC,20000);fs=2000;N=le ngth(y1);mag=abs(y1);f=(0:N-1)/N*fs;power 仁(mag92)/20000;%axes(ha ndles.axes2);plot(f,power1);xlabel('?卩?e ');ylabel('1|? e ?x');title(' e¥ ?oo ?卩?1|? e ?X ');% - Executes on butt on press in pushbutt on 10.f
35、unction pushbutt on 10_Callback(hObject, even tdata, han dles)% hObject han dle to pushbutt on 10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles and user data (see GUIDATA) %?o ? u ?卩global a;set(ha ndles.edit1,'stri ng',mea n(
36、 a);function edit1_Callback(hObject, even tdata, han dies)% hObject han die to editl (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dies structure with han dies and user data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') retur ns contents of editl as text
37、% str2double(get(hObject,'Stri ng') retur ns contents of editl as a double% - Executes during object creation, after setting all properties.function edit1_CreateFc n( hObject, even tdata, han dles)% hObject han dle to editl (see GCBO)% even tdata reserved - to be defi ned in a future version
38、 of MATLAB% han dles empty - han dles not created un til after all CreateFc ns called% Hint: edit con trols usually have a white backgro und on Win dows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'Backgro un dColor'),get(0,'defaultUico ntrolBackgro un dColor')set(
39、hObject,'Backgrou ndColor','white');end% - Executes on butt on press in pushbutt on 11.function pushbutt on 11_Callback(hObject, even tdata, han dles)% hObject handle to pushbutt on 11 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure
40、with han dles and user data (see GUIDATA) global a;set(ha ndles.edit3,'stri ng',sqrt(var(a);function edit3_Callback(hObject, even tdata, han dles)% hObject han dle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% han dles structure with han dles and user
41、 data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') retur ns contents of edit3 as text% str2double(get(hObject,'Stri ng') retur ns contents of edit3 as a double% - Executes during object creation, after setting all properties.function edit3_CreateFc n( hObject, even tdata, han dles)%
42、 hObject han dle to edit3 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles empty - han dles not created un til after all CreateFc ns called% Hint: edit con trols usually have a white backgro und on Win dows.% See ISPC and COMPUTER.if ispc && isequal(ge
43、t(hObject,'Backgro un dColor'),get(0,'defaultUico ntrolBackgro un dColor')set(hObject,'Backgrou ndColor','white');end% - Executes on butt on press in pushbutt on 12.function pushbutt on 12_Callback(hObject, even tdata, han dles)% hObject handle to pushbutt on 12 (see
44、GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUIDATA) global a;set(ha ndles.edit4,'stri ng',var(a);function edit4_Callback(hObject, even tdata, han dles)% hObject han dle to edit4 (see GCBO)% even tdata reserve
45、d - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') retur ns contents of edit4 as text%str2double(get(hObject,'Stri ng') retur ns contents of edit4 as a double% - Executes during object creatio
46、n, after setting all properties.function edit4_CreateFc n( hObject, even tdata, han dles)% hObject han dle to edit4 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles empty - han dles not created un til after all CreateFc ns called% Hint: edit con trols usually
47、have a white backgro und on Win dows. % See ISPC and COMPUTER.if ispc && isequal(get(hObject,'Backgro un dColor'), get(0,'defaultUico ntrolBackgro un dColor')set(hObject,'Backgrou ndColor','white');end% - Executes on butt on press in pushbutt on 13.function pu
48、shbutt on 13_Callback(hObject, even tdata, han dles)% hObject handle to pushbutt on 13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure with han dles and user data (see GUIDATA) %?o ?y ?卩?卩 IEMGglobal a;set(ha ndles.edit5,'stri ng',mea n( abs(
49、a);function edit5_Callback(hObject, even tdata, han dles)% hObject han dle to edit5 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles structure with han dles and user data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') retur ns contents of edit5 as text%
50、 str2double(get(hObject,'Stri ng') retur ns contents of edit5 as a double% - Executes during object creation, after setting all properties.function edit5_CreateFc n( hObject, even tdata, han dles)% hObject han dle to edit5 (see GCBO)% even tdata reserved - to be defi ned in a future version
51、of MATLAB% han dles empty - han dles not created un til after all CreateFc ns called% Hint: edit con trols usually have a white backgro und on Win dows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'Backgro un dColor'),get(0,'defaultUico ntrolBackgro un dColor')set(h
52、Object,'Backgrou ndColor','white');end% - Executes on butt on press in pushbutt on 14.function pushbutt on 14_Callback(hObject, even tdata, han dles)% hObject handle to pushbutt on 14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % han dles structure wi
53、th han dles and user data (see GUIDATA) %?o?uo DD§ ?卩 RMSglobal a;set(ha ndles.edit6,'stri ng',sqrt(mea n( a.A2);function edit6_Callback(hObject, even tdata, han dles)% hObject han dle to edit6 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles stru
54、cture with han dles and user data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') retur ns contents of edit6 as text%str2double(get(hObject,'Stri ng') retur ns contents of edit6 as a double% - Executes during object creation, after setting all properties.function edit6_CreateFc n( hObject, even tdata, han dles)% hObject han dle to edit6 (see GCBO)% even tdata reserved - to be defi ned in a future version of MATLAB% han dles empty - han dles not created un til after all Cr
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
評論
0/150
提交評論