%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function d = diodeNonlinearityCorrection(d) Applies the measured diode response curves to the switchData register. Creates a new register d.antenna0.receiver.switchDataP which contains the power in mW measured by the detector diodes. ogk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function d = diodeNonlinearityCorrection(d) 0002 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % function d = diodeNonlinearityCorrection(d) 0006 % 0007 % Applies the measured diode response curves to the switchData register. 0008 % Creates a new register d.antenna0.receiver.switchDataP which contains 0009 % the power in mW measured by the detector diodes. 0010 % 0011 % ogk 0012 % 0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0014 0015 % Each row of P contains the coefficients for the diode curve: 0016 % Power [mW] = P(k,1)*x^2 + P(k,2)*x + P(k,1) where x = Voltage [mV] 0017 % or: Power [mW] = polyval(P(k,:),x); 0018 P = [1.4598 -134.2147 20.5135; 0019 1.3845 -130.5461 14.6104; 0020 1.3955 -132.4295 10.0322; 0021 1.3926 -131.3922 12.9094; 0022 1.5340 -146.6847 10.9628; 0023 1.3808 -129.7855 13.4424; 0024 1.4594 -138.4869 9.1357; 0025 1.3829 -132.1560 6.3841; 0026 1.4087 -134.4987 7.4766; 0027 1.3618 -128.0449 11.4096; 0028 1.3665 -128.5296 12.7736; 0029 1.3694 -130.7249 19.2704]/-100000; 0030 0031 % Gain factor to correct for backend gain: 0032 G = 6.5; 0033 % Apply the correction curves: 0034 d.antenna0.receiver.switchDataP = zeros(size(d.antenna0.receiver.switchData)); 0035 for k=1:12 0036 % apply to both state 1 and 2 0037 d.antenna0.receiver.switchDataP(:,2*k-1) = polyval(P(k,:),d.antenna0.receiver.switchData(:,2*k-1)*2.5/10/G); 0038 d.antenna0.receiver.switchDataP(:,2*k) = polyval(P(k,:),d.antenna0.receiver.switchData(:,2*k)*2.5/10/G); 0039 end 0040 0041 end