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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user