A method for dynamic error compensation of a position sensor , comprising the steps of: determining a position (α) of a moving target by the position sensor with a certain sampling frequency (n, k), calculating the speed (V (n) ) of the moving target for each determined position (α (n) ), calculating a running average (V) of the speed of the moving target over a certain number of determined positions (α (n) ), and calculating a dynamic angle error (α err ) on basis of the calculated running average (V) of the speed, wherein the calculated dynamic angle error (α err ) is used to correct the output of the position sensor , characterized in that the calculated speed (V (n) ) of the moving target for the current determined position (α (n) ) is compared to the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) and if the calculated speed (V (n) ) of the moving target for the current position (α (n) ) is within a first window around the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) the dynamic angle error (α err ) is not re-calculated for the current determined position (α (n) ), and if the calculated speed (V (n) ) of the moving target for the current determined position (α (n) ) exceeds a second window around the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) the previously calculated running average (V) is deleted and the calculation of the running average (V) of the speed of the moving target over a certain number of determined positions (α) is restarted. determining a position (α) of a moving target by the position sensor with a certain sampling frequency (n, k), calculating the speed (V (n) ) of the moving target for each determined position (α (n) ), calculating a running average (V) of the speed of the moving target over a certain number of determined positions (α (n) ), and calculating a dynamic angle error (α err ) on basis of the calculated running average (V) of the speed, wherein the calculated dynamic angle error (α err ) is used to correct the output of the position sensor , characterized in that the calculated speed (V (n) ) of the moving target for the current determined position (α (n) ) is compared to the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) and if the calculated speed (V (n) ) of the moving target for the current position (α (n) ) is within a first window around the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) the dynamic angle error (α err ) is not re-calculated for the current determined position (α (n) ), and if the calculated speed (V (n) ) of the moving target for the current determined position (α (n) ) exceeds a second window around the calculated running average (V) of the speed of the moving target over the certain number of determined positions (α) the previously calculated running average (V) is deleted and the calculation of the running average (V) of the speed of the moving target over a certain number of determined positions (α) is restarted. <EOS>