functioning: it generates the scan given intial conditions and scan speed