【EEG信号处理】对信号进行模拟生成

生成信号的目的还是主要是为了学习和探究后面的分析方法;本文主要是对方法进行整理


瞬态 transient

瞬态信号是指的是一瞬间信号上去了,这种情况我们可以用在时域上高斯模拟

matlab 复制代码
peaktime = 1; % seconds
width = .12;
ampl = 9;
gaus = ampl * exp( -(EEG.times-peaktime).^2 / (2*width^2) );

非稳态 Non-stationary

频率不成稳定的

matlab 复制代码
freqmod = 5 + 20*interp1(rand(1,10),linspace(1,10,EEG.pnts)); % 范围5~25hz
signal  = ampl * sin( 2*pi * ((EEG.times + cumsum(freqmod))/EEG.srate) );

一些结合

持续的非稳态 ongoing non-stationary

这种情况往往是需要生成窄带数据

创建窄带的非平稳数据,窄带非平稳依靠的是高斯分布两边的0,和生成在频率上的高斯分布,使得频率主要集中在峰上

matlab 复制代码
% signal parameters in Hz
peakfreq = 14;
fwhm     =  5;


% frequencies
hz = linspace(0,EEG.srate,EEG.pnts);

%%% create frequency-domain Gaussian 生成频域高斯分布
s  = fwhm*(2*pi-1)/(4*pi); % normalized width
x  = hz-peakfreq;          % shifted frequencies
fg = exp(-.5*(x/s).^2);    % gaussian

% Fourier coefficients of random spectrum
fc = rand(1,EEG.pnts) .* exp(1i*2*pi*rand(1,EEG.pnts));
        
% taper Fourier coefficients by the Gaussian
fc = fg .* fc; % 将随机频谱的傅里叶系数与生成的窗口函数相乘;更像给高斯分布加了一点噪声

% go back to time domain to get EEG data
EEG.data(chani,:,triali) = real( ifft(fc) );

瞬时振荡信号 transient oscillations

瞬时还是利用高斯来实现,振荡就要利用到正弦来进行振荡了

matlab 复制代码
% sine wave frequency
sfreq = 8;

% gaussian parameters (in seconds)
peaktime = 1;
width = .2;
trialpeak = peaktime + randn/5;
gaus = exp( -(EEG.times-trialpeak).^2 / (2*width^2) );


% generate sine wave with same phase
sw = cos(2 * pi * sfreq * EEG.times);


% data are sine wave times Gaussian
EEG.data(chani,:,triali) = sw .* gaus;

噪音

白噪声

matlab 复制代码
% 可以直接用正态分布或者均匀分布来生成
randn(EEG.nbchan, EEG.pnts, EEG.trials);

粉噪声

matlab 复制代码
% the key parameter of pink noise is the exponential decay (ed)
ed = 50;

% generate one-sided 1/f amplitude spectrum
as = rand(1,EEG.pnts) .* exp(-(0:EEG.pnts-1)/ed);
        
% Fourier coefficients as amplitudes times random phases
fc = as .* exp(1i*2*pi*rand(size(as)));
        
% inverse Fourier transform to create the noise
EEG.data(chani,:,triali) = real(ifft(fc));
相关推荐
奔袭的算法工程师14 天前
论文解读--Sparse4D v3: Advancing End-to-End 3D Detection and Tracking
人工智能·目标检测·计算机视觉·自动驾驶·信号处理
江畔柳前堤15 天前
github实战指南01-账号配置与 SSH 密钥
运维·人工智能·深度学习·ssh·github·pyqt·信号处理
江畔柳前堤15 天前
github实战指南02-仓库管理与 Issue
人工智能·深度学习·github·信号处理·caffe·wps·issue
小白小宋16 天前
【PUSCH番外篇】5G NR 相位补偿与频移校正:原理、流程与工程实现
算法·5g·matlab·信息与通信·信号处理
DreamLife☼16 天前
OpenBCI-实时BCI系统:低延迟与闭环控制
人工智能·信息可视化·信号处理·开源硬件·脑机接口·低延迟·openbci
network_tester17 天前
TSN交换机研发测试怎么做?一套可落地的“信而泰仪器 + 康芯源服务”方案解读
网络·网络协议·tcp/ip·车载系统·汽车·信息与通信·信号处理
Code-keys18 天前
ARM NEON SIMD 编程实战:从音频信号处理到AI算子研发实战
arm开发·音视频·信号处理
MARIN_shen18 天前
Marin说PCB之高速信号SERDES (GMSL2)信号换层孔打在焊盘中心真的好吗?---01
硬件工程·信号处理·pcb工艺
Inhand陈工20 天前
映翰通IG502实战:通过RS232采集交通信号灯数据,实现自动短信告警
网络·嵌入式硬件·物联网·网络安全·边缘计算·信息与通信·信号处理
network_tester21 天前
SENT/PSI5传感器TSN集成测试:打通传统传感与未来车载网络的“最后一公里”
数据库·网络协议·tcp/ip·自动驾驶·信息与通信·信号处理·tcpdump