%--------------------------------------------------------------------------- % SYNTAX: f=r2f(R <,lenstype>) % <...> indicates optional arguments % % % Uses a lookup table or a formula to obtain the focal length of a % spherical lens for 1064 nm light from the radius of curvature. % % % % INTPUT ARGUMENTS: % R = radius of curvature [mm] % lenstype = Defines the source to use for the conversion. Can be on of % the following: % % cvi_plcx_bk7 -- CVI corp. plano-convex, BK7 lenses % cvi_bicx_bk7 -- CVI corp. bi-convex, BK7 lenses % cvi_plcc_bk7 -- CVI corp. plano-concave, BK7 lenses % cvi_bicc_bk7 -- CVI corp. bi-concave, bK7 lenses % cvi_plcx_sio2 -- CVI corp. plano-convex, Fused Silica lenses % cvi_bicx_sio2 -- CVI corp. bi-convex, Fused Silica lenses % cvi_plcc_sio2 -- CVI corp. plano-concave, Fused Silica lenses % cvi_bicc_sio2 -- CVI corp. bi-concave, Fused Silica lenses % default -- uses the formula R=2f. % % OUTPUT ARGUMENTS: % f = focal length of the lens [mm] % %--------------------------------------------------------------------------- % SYNTAX: f=r2f(R <,lenstype>) %------------------------------------------------------------------------------- function f=r2f(R,varargin); if nargin>=2, lenstype=varargin{1}; else lenstype='default'; end switch lower(lenstype) case 'default' f=2*R; case 'cvi_plcx_bk7' rawdata=load('CVI_PLCX_bK7_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_bicx_bk7' rawdata=load('CVI_BICX_BK7_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_plcc_bk7' rawdata=load('CVI_PLCC_bK7_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_bicc_bk7' rawdata=load('CVI_BICC_BK7_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_plcx_sio2' rawdata=load('CVI_PLCX_SIO2_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_bicx_sio2' rawdata=load('CVI_BICX_SIO2_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_plcc_sio2' rawdata=load('CVI_PLCC_SIO2_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end disp(['R = ',num2str(Rfound),' -> R = ',num2str(f),' mm.']); case 'cvi_bicc_sio2' rawdata=load('CVI_BICC_SIO2_r2f_index.txt'); [data(:,1),sortorder]=sort(rawdata(:,1)); % R now in 1st col, in ascending order data(:,2)=rawdata(sortorder',2); % f in 2nd column [posn,exactmatch]=pos(data(:,1),R); Rfound=data(posn,1); f=data(posn,2); if ~exactmatch disp(['R is not found in the catalog table. Closest R is ',num2str(Rfound),' mm.']); end otherwise error('lenstype not recognized'); end end