【信號處理】脈搏信號處理系統(tǒng)含Matlab源碼
1 簡介
脈搏信號是人體最重要的生理信號之一,它包含大量生理病理信息.體內(nèi)各種狀態(tài)變化都會反映在脈搏信號中.而脈搏信號的改變或雜音的出現(xiàn),往往是人體各器官病癥的最早表征.脈搏信號的研究可以清楚地了解身體的生理特性,為疾病診斷提供重要依據(jù).
2 部分代碼
%% Program Start
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% 功能:脈搏信號處理系統(tǒng)GUI預(yù)處理對比界面
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
function varargout = COPM(varargin)
% COPM MATLAB code for COPM.fig
% ? ? ?COPM, by itself, creates a new COPM or raises the existing
% ? ? ?singleton*.
%
% ? ? ?H = COPM returns the handle to a new COPM or the handle to
% ? ? ?the existing singleton*.
%
% ? ? ?COPM('CALLBACK',hObject,eventData,handles,...) calls the local
% ? ? ?function named CALLBACK in COPM.M with the given input arguments.
%
% ? ? ?COPM('Property','Value',...) creates a new COPM or raises the
% ? ? ?existing singleton*. ?Starting from the left, property value pairs are
% ? ? ?applied to the GUI before COPM_OpeningFcn gets called. ?An
% ? ? ?unrecognized property name or invalid value makes property application
% ? ? ?stop. ?All inputs are passed to COPM_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 COPM
% Last Modified by GUIDE v2.5 15-Dec-2019 20:03:34
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', ? ? ? mfilename, ...
? ? ? ? ? ? ? ? ? 'gui_Singleton', ?gui_Singleton, ...
? ? ? ? ? ? ? ? ? 'gui_OpeningFcn', @COPM_OpeningFcn, ...
? ? ? ? ? ? ? ? ? 'gui_OutputFcn', ?@COPM_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 COPM is made visible.
function COPM_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 COPM (see VARARGIN)
% Choose default command line output for COPM
handles.output = hObject;
ha=axes('units','normalized','position',[0 0 1 1]);
uistack(ha,'down')
II=imread('888.jpg');
image(II)
colormap gray
set(ha,'handlevisibility','off','visible','off');
% Update handles structure
axes(handles.axes1);
axes(handles.axes2);
axes(handles.axes3);
axes(handles.axes4);
axes(handles.axes5);
axes(handles.axes6);
axes(handles.axes7);
axes(handles.axes8);
axes(handles.axes9);
axes(handles.axes10);
axes(handles.axes11);
axes(handles.axes12);
% Update handles structure
guidata(hObject, handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%前面的代碼不用管
% UIWAIT makes COPM wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = COPM_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 on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
%%%%%把代碼放到這,運行時自動加載
[filename,filepath]=uigetfile('C:\Users\dell\Desktop\信號處理課設(shè)-----楊碩\初始脈搏數(shù)據(jù)\MaiBobefore.txt');
filename=[filepath,filename];
[t,Pluse_pre]=textread(filename,'%f%f','headerlines',1);%讀入2個浮點值,并跳過文檔的第1行
[m,n]=size(Pluse_pre);
n=3;
s3=Pluse_pre;
%%%%%%%%%%%%—————提取2000個點進(jìn)行數(shù)據(jù)處理——————%%%%%%%%%%%%%%%%%%%%
fs=360;%采樣率
x0=s3(1:2000);%取1到2000共2000個點
t=1:length(x0);%length(x0)指x0數(shù)組元素的個數(shù)
axes(handles.axes1);
plot(t,x0)
xlabel('采樣點');
ylabel('magtitude');
title('標(biāo)準(zhǔn)脈搏信號')
box1=msgbox('正在加載請稍候','提示');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%初步去除基線漂移%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%中值濾波%%%%%%%%%%%%%%%%%%%%%%%%%%%%
? ?L1=medfilt1(x0,330); %一維中值濾波,x0為數(shù)組,即要處理原始波形,n是中值濾波器的參數(shù),L1是濾波以后的結(jié)果(數(shù)組)
? ?L2=x0-L1;
axes(handles.axes2);
plot(t,L2)
xlabel('采樣點');
ylabel('magtitude');
title('中值濾波后的脈搏信號')
drawnow;%刷新屏幕,實時顯示
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%頻譜%%%%%%%%%%%%%%%%%%%%%%%%
N=length(x0);%樣點個數(shù)
df=fs/(N-1);%分辨率
f=(0:N-1)*df;%其中每點的頻率
Y=fft(L2(1:N))/N*2;%真實的幅值
axes(handles.axes3);
plot(f(1:N/2),abs(Y(1:N/2)));%傅里葉變換后的頻譜圖是對稱的,這里需要一半就可以了
xlabel('頻率/Hz');
ylabel('振幅');
axis ( [0 100 0 0.4] );
title('中值濾波后脈搏信號頻率譜')
drawnow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%去除工頻干擾%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%利用雙線性變換法設(shè)計butterworth帶阻濾波器
f0=90;%工頻干擾頻率90Hz
B1=0.3;
N=2;
fs=360;%采樣率
T=1/fs;
rp=3;%通帶衰減
rs=N/2*10;%阻帶衰減
w
3 仿真結(jié)果




4 參考文獻(xiàn)
[1]陳曉彤. 脈搏信號預(yù)處理與特征提取[D]. 西安科技大學(xué), 2015.
博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測、信號處理、元胞自動機、圖像處理、路徑規(guī)劃、無人機等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問題可私信交流。
部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。
