function q = sense(p, Z)
  world = {'green','red','red','green','green'};
  pHit = 0.6;
  pMiss = 0.2;
  hit = strcmp(world,Z);
  q = p .* (hit * pHit + (1-hit)*pMiss);
  s = sum(q);
  q = q / s;
return