function make_stim(id1,dur1,isi,id2,dur2,iti,trials)

global stim_time CS US

for i = 1:trials
  for id = id1
    switch id
      case {1,2}  
	CS(stim_time:(stim_time+dur1-1),id) = 1;
      case 3
	US(stim_time:(stim_time+dur1-1)) = 1;
    end
  end
  stim_time = stim_time + isi;
  for id = id2
    switch id
      case {1,2}  
	CS(stim_time:(stim_time+dur2-1),id) = 1;
      case 3
	US(stim_time:(stim_time+dur2-1)) = 1;
    end
  end
  stim_time = stim_time + iti;
end
