📄 eeg_demo.m
字号:
clear
echo on
% This Demo program is to generate different
% segments of EEG signal and to online track
% theses segments
% press any key to continue
pause
% First generation of the eeg signal that consists
% of different segments
% using sim_eeg function
% sampling frequency
fs=160;
x=sim_eeg(5,fs,[0.5 3.5],[0 64]);
x=[x;sim_eeg(5,fs,[4 7],[0 64])];
x=[x;sim_eeg(5,fs,[7.5 12],[0 64])];
x=[x;sim_eeg(5,fs,[12.5 15],[0 64])];
x=[x;sim_eeg(5,fs,[12.5 20],[0 64])];
x_ax=0:length(x)-1;x_ax=x_ax/fs;
subplot(311),plot(x_ax,x,'k');
v=[0 max(x_ax) min(x)-1 max(x)+1];axis(v)
grid
% press any key to continue
pause
% using the matlab spectogram function we
% can track the eeg segments
b=specgram(x,64,fs);
[lr lc]=size(b');
lr=(lr+1)*64/2;
x_ax=0:1:lr;x_ax=x_ax./fs;
y_ax=0:1/lc:1-1/lc;y_ax=y_ax*fs;
subplot(312),image(x_ax,y_ax,abs(b));
ylabel('frequency');
% press any key to continue
pause
% using our segmenting function for tracking the
% eeg segments
w=eeg_seg(x,fs);
x_ax=0:length(w)-1;x_ax=x_ax/fs;
subplot(313),plot(x_ax,w),grid
xlabel('time, sec')
ylabel('w(t)')
v=[0 max(x_ax) min(w)-0.1 max(w)+0.1];
axis(v)
echo off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -