我的目标是产生嘈杂的ECG信号。我只希望较短的信号有噪声,所以我需要实现连续变化(而不是步进变化!)。
我已经尝试过插值,但是存在一个问题,即如何从零噪声水平变为一定百分比的噪声,然后再回到零噪声水平。该实现将在Matlab中进行。
您对如何实施此方法有任何想法吗?预先谢谢!
我没有心电图经验,但是我可以建议一个解决方案:
这里是代码示例:
%Read sample EEG file (MATLAB built in sample).
load('ecgsig.mat');
E = ecgsig(1:end/100); %Take only 1% of data sample
T = zeros(size(E));
%Create an stripe of ones.
T(1+end*3/8:end*5/8) = 1;
%Smooth T - create smooth change by applying gaussian filter.
%T = imgaussfilt(T, 1000);
h = fspecial('gaussian', [1000, 1] ,300);
T = conv(T, h, 'same');
%Build "Noise signal" in size of E - gaussian noise with zero mean (I used image processing toolbox function).
N = imnoise(ones(size(E))*0.5, 'gaussian', 0, 0.1) - 0.5;
%Multiply "Noise signal" by the "smooth transition" mask.
N = N.*T;
%Add the masked "Noise signal" to the original signal.
J = E + N;
figure;plot(J);grid on;