-
Notifications
You must be signed in to change notification settings - Fork 14
/
GenNoisySig.m
49 lines (39 loc) · 1.44 KB
/
GenNoisySig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function noisySig=GenNoisySig(sigDur,sigFreq,sampFreq,phaseShift,numCh)
% parameters
% sigDur = 3; % Duration (sec)
% sigFreq = 9; % Frequency (Hz)
% sampFreq = 250; % Sampling Frequency (Hz)
% phaseShift = pi/2;
sigAmp = 3;
sigOffset = 0; %1.5;
noiseAmp = 0.5;
timeVec = linspace(0, sigDur, sampFreq*sigDur); % Time Vector
% sampInterv = 1/sampFreq;
% timeVec = 0:sampInterv:1-sampInterv; % 1s signal
%generate signal
for chNum=1:numCh
sig = sigOffset + sigAmp*sin(((2*pi*sigFreq*timeVec))+(phaseShift*chNum)); % % Signal (10 kHz sine)
noisySig(chNum,:) = sig + noiseAmp*(randn(size(sig)));%-0.5
end
% figure; hold on
% plot(noisySig(1,:))
% plot(noisySig(end,:))
% figure;
% imagesc(noisySig)
%% cool effects:
% for chNum=1:64
% sig = sigOffset + sigAmp*sin(2*(pi+0.5*chNum*pi)*sigFreq*timeVec); % Signal (10 kHz sine)
% noisySig(chNum,:) = sig + noiseAmp*(randn(size(sig))-0.5);
% end
%
% for chNum=1:64
% sig = sigOffset + sigAmp*sin((2*pi+0.5*chNum)*sigFreq*timeVec); % Signal (10 kHz sine)
% noisySig(chNum,:) = sig + noiseAmp*(randn(size(sig))-0.5);
% end
% for chNum=1:64
% sig = sigOffset + sigAmp*sin(((2*pi*sigFreq)+(pi/2*chNum))*timeVec); % Signal (10 kHz sine)
% noisySig(chNum,:) = sig + noiseAmp*(randn(size(sig))-0.5);
% end
%
% figure;
% imagesc(noisySig)