1. A method for determining a system frequency for magnetic resonance (MR) imaging, comprising: operating an MR data acquisition unit to acquire a frequency spectrum of an examination region in the MR scanner; providing said frequency spectrum to a computer and, in said computer, automatically determining a cost function that represents a difference between a predetermined model function having assigned parameters, which is to be optimized, and the acquired frequency spectrum; in said computer, executing a minimization algorithm that minimizes said cost function; in said computer, executing an optimization algorithm that optimizes said model function, to obtain an optimized parameterized model function, and determining parameters of said optimized parameterized model function corresponding to the minimized cost function; and in said computer, using the determined parameters to determine said system frequency and emitting an electronic signal from said computer representing said system frequency.