MATLAB help - writing a function involving the power method and matrices,please help?

i've been given the following problem to work on, i've tried different commands etc and can't get any of them to work. if anyone could write this function and show me the commands they've used, i'd be ever so grateful!!

write a function m-file called matrix.m which takes as its arguments a square matrix A, a vector z and an error tolerance epsilon. the function should carry out iterations of the power method, taking z as the initial vector, until successive approximations to the eigenvector associated with the dominant eigenvalue of A differ in norm by less then epsilon. the funtion should ouput an approximation to the dominant eigenvalue of A, an approximation to the corresponding eigenvector and also an integer showing how many iterations were needed

any help would be much appreciated!!

thanks x