Iterative Learning Control (ILC) can achieve superior tracking performance for systems that perform repeating tasks. However, the performance of standard ILC deteriorates dramatically when the task is varied. In this paper ILC is extended with rational basis functions to obtain excellent extrapolation properties. A new approach for rational basis functions is proposed where the iterative solution algorithm is of the form used in instrumental variable system identification algorithms. The optimal solution is expressed in terms of learning filters similar as in standard ILC. The proposed approach is shown to be superior over existing approaches in terms of performance by a simulation example