Update April
This commit is contained in:
@@ -8,6 +8,9 @@ classdef Photodiode
|
||||
dark_current
|
||||
temperature
|
||||
|
||||
randomkey
|
||||
randomstream
|
||||
|
||||
end
|
||||
|
||||
methods
|
||||
@@ -18,14 +21,16 @@ classdef Photodiode
|
||||
options.fsimu
|
||||
options.responsivity = 1;
|
||||
options.dark_current = 0;
|
||||
options.temperature = 20;
|
||||
options.temperature = 20;
|
||||
options.randomkey = 1;
|
||||
end
|
||||
|
||||
obj.fsimu = options.fsimu;
|
||||
obj.responsivity = options.responsivity;
|
||||
obj.dark_current = options.dark_current;
|
||||
obj.temperature = options.temperature;
|
||||
|
||||
fn = fieldnames(options);
|
||||
for l = 1:numel(fn)
|
||||
obj.(fn{l}) = options.(fn{l});
|
||||
end
|
||||
|
||||
obj.randomstream = RandStream('mlfg6331_64','Seed',obj.randomkey);
|
||||
end
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in)
|
||||
@@ -50,15 +55,16 @@ classdef Photodiode
|
||||
% Detailed explanation goes here
|
||||
|
||||
k = Constant.Boltzmann;
|
||||
q = Constant.ElementaryCharge;
|
||||
|
||||
T = obj.temperature + 273.15 ; %celsius + 273 = kelvin
|
||||
R = 50; %resistance of phdiode (50ohm is typical value)
|
||||
|
||||
% Magnitude squared detection
|
||||
yout = sum( abs(xin) .^2*obj.responsivity, 2 ) ;
|
||||
|
||||
% Magnitude squared detection (sum over pols)
|
||||
yout = sum( abs(xin) .^2 * obj.responsivity, 2 ) ;
|
||||
|
||||
% Shot Noise
|
||||
shot_noise = sqrt(k * obj.fsimu .* yout) .* randn(size(yout,1),1);
|
||||
shot_noise = sqrt(q * obj.fsimu .* yout) .* randn(obj.randomstream,size(yout,1),1);
|
||||
|
||||
yout = yout + shot_noise;
|
||||
|
||||
@@ -68,7 +74,7 @@ classdef Photodiode
|
||||
Bw = obj.fsimu; %is this correct? shouldnt it be the bandwidth of the actual component? e.g. 70GHz?
|
||||
therm_noise_pow = therm_current_psd * 2 * Bw; %squared
|
||||
|
||||
therm_noise = sqrt(therm_noise_pow) .* randn(size(yout,1),1);
|
||||
therm_noise = sqrt(therm_noise_pow) .* randn(obj.randomstream,size(yout,1),1);
|
||||
|
||||
yout = yout + therm_noise;
|
||||
|
||||
|
||||
@@ -17,8 +17,10 @@ classdef Scope
|
||||
fixed_delay %fix the delay of the filter or use minimal delay for kausal system
|
||||
delay %specify a fixed delay of the filter
|
||||
|
||||
lpf_active
|
||||
filtertype
|
||||
lpf_bw
|
||||
H_lpf
|
||||
|
||||
block_dc
|
||||
|
||||
@@ -47,8 +49,10 @@ classdef Scope
|
||||
options.fixed_delay = 0;
|
||||
options.delay = 0;
|
||||
|
||||
options.lpf_active = 0;
|
||||
options.filtertype = filtertypes.bessel_bilin;
|
||||
options.lpf_bw = 120e9;
|
||||
options.H_lpf;
|
||||
|
||||
options.block_dc = 1;
|
||||
end
|
||||
@@ -65,12 +69,27 @@ classdef Scope
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in)
|
||||
|
||||
% apply LPF
|
||||
lpf = Filter('filtdegree',3,"f_cutoff",obj.lpf_bw,"fsamp",obj.fsimu,"filterType",obj.filtertype);
|
||||
signalclass_in = lpf.process(signalclass_in);
|
||||
|
||||
% actual processing of the signal
|
||||
signalclass_in.signal = obj.process_(signalclass_in.signal);
|
||||
signalclass_in.fs = obj.fadc;
|
||||
|
||||
% apply LPF
|
||||
% 4. Apply LPF on the signal
|
||||
assert (signalclass_in.fs == obj.H_lpf.fs)
|
||||
if obj.lpf_active
|
||||
if isa(obj.H_lpf,'Filter')
|
||||
%4.A) user already specified a complete filter class when
|
||||
% initializing the AWG module
|
||||
signalclass_in = obj.H_lpf.process(signalclass_in);
|
||||
else
|
||||
%4.B) just use a standard filter
|
||||
obj.H_lpf = Filter('filtdegree',3,"f_cutoff",obj.lpf_bw,"fsamp",obj.fsimu,"filterType",obj.filtertype);
|
||||
signalclass_in = obj.H_lpf.process(signalclass_in);
|
||||
end
|
||||
end
|
||||
|
||||
% cast the electrical signal to information signal
|
||||
signalclass_in = Informationsignal(signalclass_in,"fs",obj.fadc,"logbook",signalclass_in.logbook);
|
||||
|
||||
% append to logbook
|
||||
lbdesc = ['Scope '];
|
||||
|
||||
Reference in New Issue
Block a user