function Default

multiple_population_handle = findobj('Tag','Fig_multiple_population');

number_of_populations_handle = findobj(multiple_population_handle,'Tag','EditText_number_of_populations');
populations_handle = findobj(multiple_population_handle,'Tag','PopupMenu_populations');
maximum_time_handle = findobj(multiple_population_handle,'Tag','EditText_maximum_time');
number_of_time_steps_handle = findobj(multiple_population_handle,'Tag','EditText_number_of_time_steps');
maximum_x_handle = findobj(multiple_population_handle,'Tag','EditText_maximum_x');
number_of_x_intervals_handle = findobj(multiple_population_handle,'Tag','EditText_number_of_x_intervals');
uo_handle = findobj(multiple_population_handle,'Tag','EditText_uo');
growth_rate_handle = findobj(multiple_population_handle,'Tag','EditText_growth_rate');
morality_rate_handle = findobj(multiple_population_handle,'Tag','EditText_morality_rate');
reproduction_rate_handle = findobj(multiple_population_handle,'Tag','EditText_reproduction_rate');
inflow_handle = findobj(multiple_population_handle,'Tag','EditText_inflow');
weighing_function_handle = findobj(multiple_population_handle,'Tag','EditText_weighing_function');
probability_handle=findobj(multiple_population_handle,'Tag','EditText_Probability');
cont_handle = findobj(multiple_population_handle,'Tag','Radiobutton_cont');

current_population = get(populations_handle,'Value');

parameters = get(multiple_population_handle,'UserData');

num_pop = str2num(get(number_of_populations_handle,'String'));

Psum = 'P1';
Pmul = 'P1';
for i = 2:num_pop
   Psum = [Psum,'+P',num2str(i)];
   Pmul = [Pmul,'*P',num2str(i)];
end

for i = 1:num_pop
   parameters{3}(i) = setfield(parameters{3}(current_population),'uo','3*exp(-10*(x-.01)^2)');
   parameters{3}(i) = setfield(parameters{3}(current_population),'g',['5*(',Psum,')*exp(-2*(',Psum,'))*(1-x)']);
   parameters{3}(i) = setfield(parameters{3}(current_population),'m',['(',Psum,')/(1+',Psum,')']);
   parameters{3}(i) = setfield(parameters{3}(current_population),'b',['0.2*exp(-0.2*(',Psum,'))*x']);
   parameters{3}(i) = setfield(parameters{3}(current_population),'c','0');
   parameters{3}(i) = setfield(parameters{3}(current_population),'w','(0.2*(y<=x)+(y>x))*y');
   parameters{3}(i) = setfield(parameters{3}(current_population),'gam',['1/',num2str(num_pop),'*ones(1,',num2str(num_pop),')']);
end

set(multiple_population_handle,'UserData',parameters);

set(maximum_time_handle,'String','1.5');
set(number_of_time_steps_handle,'String','150');
set(maximum_x_handle,'String','1');
set(number_of_x_intervals_handle,'String','100');
set(uo_handle,'String','3*exp(-10*(x-.01)^2)');
set(growth_rate_handle,'String',['5*(',Psum,')*exp(-2*(',Psum,'))*(1-x)']);
set(morality_rate_handle,'String',['(',Psum,')/(1+',Psum,')']);
set(reproduction_rate_handle,'String',['0.2*exp(-0.2*(',Psum,'))*x']);
set(inflow_handle,'String','0');
set(weighing_function_handle,'String','(0.2*(y<=x)+(y>x))*y');
set(probability_handle,'String',['1/',num2str(num_pop),'*ones(1,',num2str(num_pop),')']);
set(cont_handle,'Value',1);

