The invention relates to a method of controlling the speed of a ventricular assist device, in particular the rotational speed of a rotary blood pump, wherein at least temporarily the speed of the device is modulated around a mean speed and a response of the native heart to this modulation is measured to determine the ventricular function/contractile state of the heart, in particular to determine whether the aortic valve opens and closes at the instant mean speed, and the mean speed is set, in particular a new mean speed is set in dependence of the measured response. The invention furthermore relates to a device performing the method.