-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathratiotest.m
More file actions
34 lines (31 loc) · 1.02 KB
/
Copy pathratiotest.m
File metadata and controls
34 lines (31 loc) · 1.02 KB
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
%signal averaging example:
x = 0:1:128;
gaus = jmgauss(x-0.5*max(x),0.5*max(x));
sig = jmgauss(x-0.5*max(x),0.5*max(x))-0.5*max(gaus)*sin((x-0.5*max(x))/15);
noigaus = zeros(size(gaus));
noisig = noigaus;
pershot = noigaus;
summedgaus = noigaus;
summedsig = noigaus;
sumpershot = noigaus;
randn('state', sum(100*clock));
for i = 1:2000;
noise = 0.1*max(gaus)*randn(size(gaus))+0.5;
noigaus(i,:) = gaus+noise;
noisig(i,:) = sig+noise;
pershot(i,:) = -log10((noisig(i,:)./noigaus(i,:)))-(-log10((noigaus(i,:)./noigaus(i,:))));
summedgaus = summedgaus+noigaus(i,:);
summedsig = summedsig+noisig(i,:);
sumpershot = sumpershot+pershot(i,:);
end
summedshots = -log10(((summedsig./summedgaus)))-(-log10((summedgaus./summedgaus)));
figure
subplot(4,1,1);
plot(x,noigaus(i,:),x,noisig(i,:));
subplot(4,1,2);
plot(x,-log10((noisig(i,:)./noigaus(i,:)))-(-log10((noigaus(i,:)./noigaus(i,:)))));
subplot(4,1,3);
plot(x,sumpershot./2000);
subplot(4,1,4);
plot(x,summedshots./2000);
clear gaus sig noise pershot noigaus noisig