您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > 54基于matlab的肌电信号处理程序:
基于matlab的肌电信号处理程序:functionvarargout=untitled(varargin)%UNTITLEDM-fileforuntitled.fig%UNTITLED,byitself,createsanewUNTITLEDorraisestheexisting%singleton*.%%H=UNTITLEDreturnsthehandletoanewUNTITLEDorthehandleto%theexistingsingleton*.%%UNTITLED('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinUNTITLED.Mwiththegiveninputarguments.%%UNTITLED('Property','Value',...)createsanewUNTITLEDorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforeuntitled_OpeningFcngetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtountitled_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.ChooseGUIallowsonlyone%instancetorun(singleton).%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponsetohelpuntitled%LastModifiedbyGUIDEv2.508-Nov-201412:45:18%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@untitled_OpeningFcn,...'gui_OutputFcn',@untitled_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---Executesjustbeforeuntitledismadevisible.functionuntitled_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstountitled(seeVARARGIN)%Choosedefaultcommandlineoutputforuntitledhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesuntitledwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=untitled_OutputFcn(hObject,eventdata,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;%---Executesonbuttonpressinpushbutton1.functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globals;globala;globalt;globalcount;%count=1;[filename,filepath]=uigetfile('*.txt','Ñ¡ÔñÎļþ');%Ñ¡ÔñÊý¾ÝÎļþstr=[filepathfilename];s=load(str);a=s(:,7);t=s(:,1);axes(handles.axes1);plot(t,a);xlabel('ʱ¼ä');ylabel('±äÁ¿');title('ÔʼÐźÅ');ifcount==2globals2;globala2;globalt2;[filename,filepath]=uigetfile('*.txt','Ñ¡ÔñÎļþ');str=[filepathfilename];s2=load(str);a2=s2(:,7);t2=s2(:,1);plot(handles.axes2,t2,a2);endcount=1;%---Executesonbuttonpressinpushbutton2.functionpushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globala;globalt;globals;globaly;%globalIR;%globalSORH;y=fft(a,20000);M=length(a);N=length(y);p=size(a);%s1=a(1:20000);[CL]=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,PERF2]=wdencmp('lvd',a,...'db5',3,TR,SORH);L=p(2);x=a;h=XC;F=0;M=0;forii=1:Lm(ii)=(x(ii)-y(ii))^2;t(ii)=y(ii)^2;f(ii)=t(ii)/m(ii);F=F+f(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));%---Executesonbuttonpressinpushbutton3.functionpushbutton3_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globala;globalt;globaly;globalcount;%a=EMG3(1:points,2);y=fft(a,20000);%¶ÔÐźŽøÐпìËÙFourier±ä»»fs=2000;N=length(y);mag=abs(y);%ÇóµÃFourier±ä»»ºóµÄÕñ·ùf=(0:N-1)/N*fs;%ƵÂÊÐòÁÐaxes(handles.axes1);plot(f,mag);%plot(handles.axes1,f,mag);%»æÖÆͼÐÎxlabel('ƵÂÊ');ylabel('·ùÖµ');title('Ô¼¡µç·ùƵN=20000');ifcount==2globala2;globalt2;globaly2;%a=EMG3(1:points,2);y2=fft(a2,20000);%¶ÔÐźŽøÐпìËÙFourier±ä»»fs=2000;N=length(y2);mag=abs(y2);%ÇóµÃFourier±ä»»ºóµÄÕñ·ùf=(0:N-1)/N*fs;%ƵÂÊÐòÁÐaxes(handles.axes2);plot(f,mag);endcount=1;%---Executesonbuttonpressinpushbutton4.functionpushbutton4_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton4(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globala;globalt;%globalIR;%globalSORH;[CL]=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(c
本文标题:54基于matlab的肌电信号处理程序:
链接地址:https://www.777doc.com/doc-3135821 .html