initialization and frequency matrix