The Pascal matrix and the Fibonacci matrix are among the most well-known and the most widely-used tools in elementary algebra. In this paper, after a brief introduction where we give the basic definitions and the historical backgrounds of these concepts, we propose an algorithm that will generate the elements of these matrices. In fact, we will show that the indicated algorithm can be used to construct the elements of any power series matrix generated by any polynomial (see Definition 1), and hence, it is a generalization of the specific algorithms that give us the Pascal and the Fibonacci matrices.