Dynamic Matched Filter for Detection of Gravitational Waves