
%%%%%%%%%%% BEGIN encounter.m %%%%%%%%%%%%%%%%%
%% basic simulation quantifying encounter rate. smd april 2005
%% amended to be preceded by a basic gui
clear all
close all

%%% test variables that you should modify
Ns=1;              % searchers (sperm, motile predator);
Nt= 1;            % targets (eggs, phytoplankton, passive for now);
search_radius=10;    % size of the target, equivalent to sensory range of the searcher
speedNs = 10;        % swimming speed of the searcher
speedNt= 0;         % swimming speed of the target

h_main=figure; 
set(h_main,'Position', [521 297 350 420]) % the first value determines x distance from the left side
set(h_main,'Name', 'Encounter Rate Model Initial Values')
set(h_main,'MenuBar','none')
set(h_main,'Color', [0.682353 0.701961 0.823529])
set(h_main,'NumberTitle','off')

xdist = 220; 
ydist = 350; 
wide = 100; 
high = 30; 
sepdist = 90;

%%% specify all input variables
% number of targets
h_Nt = uicontrol('style','edit','position',[xdist ydist wide high], ...
     'string',Nt,'FontSize',14); 
set(h_Nt,'BackgroundColor',[0.682353 0.701961 0.823529])
Ntt= uicontrol('style','text','position',[xdist-210 ydist-1 wide*2 high], ...
    'string','Number of Targets','FontSize',14); 
set(Ntt,'BackgroundColor',[0.682353 0.701961 0.823529])

ydist=ydist+high-sepdist; 

% number of searchers
h_Ns = uicontrol('style','edit','position',[xdist ydist wide high], ... 
    'string',Ns,'FontSize',14); 
set(h_Ns,'BackgroundColor',[0.682353 0.701961 0.823529])

Nst= uicontrol('style','text','position',[xdist-210 ydist-1 wide*2 high], ... 
    'string','Number of Searchers','FontSize',14); 
set(Nst,'BackgroundColor',[0.682353 0.701961 0.823529])

ydist=ydist+high-sepdist; 

% Target size
h_sr = uicontrol('style','edit','position',[xdist ydist wide high], ... 
    'string',search_radius,'FontSize',14); 
set(h_sr,'BackgroundColor',[0.682353 0.701961 0.823529])

srt= uicontrol('style','text','position',[xdist-210 ydist-1 wide*2 high], ... 
    'string','Target Size','FontSize',14); 
set(srt,'BackgroundColor',[0.682353 0.701961 0.823529])

ydist=ydist+high-sepdist; 
% Target speed
h_sNt = uicontrol('style','edit','position',[xdist ydist wide high], ... 
    'string',speedNt,'FontSize',14); 
set(h_sNt,'BackgroundColor',[0.682353 0.701961 0.823529])

sNtt= uicontrol('style','text','position',[xdist-210 ydist-1 wide*2 high], ... 
    'string','Target Speed','FontSize',14); 
set(sNtt,'BackgroundColor',[0.682353 0.701961 0.823529])

ydist=ydist+high-sepdist; 
% Searcher speed
h_sNs = uicontrol('style','edit','position',[xdist ydist wide high], ... 
    'string',speedNs,'FontSize',14); 
set(h_sNs,'BackgroundColor',[0.682353 0.701961 0.823529])

sNst= uicontrol('style','text','position',[xdist-210 ydist-1 wide*2 high], ... 
    'string','Searcher Speed','FontSize',14); 
set(sNst,'BackgroundColor',[0.682353 0.701961 0.823529])

ydist=ydist+high-sepdist; 

h_run=uicontrol('style','pushbutton','position',[xdist ydist wide high], ... 
    'string','Run Model','call','enc_code'); 
set(h_run,'BackgroundColor',[0.682353 0.701961 0.823529], 'FontSize', 14)


%%%%%%%%%%% END encounter.m %%%%%%%%%%%%%%%%%


