1. A method for determining a system frequency for magnetic resonance (MR) imaging, comprising: prior to operating an MR data acquisition scanner with a computer in order to acquire diagnostic MR data from an examination region of a subject, providing the computer with a frequency spectrum acquired from the examination region in the MR data acquisition scanner; in said computer, automatically determining a cost function that represents a difference between a predetermined model function that is parameterized with assigned parameters, 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 parameterized model function, to obtain an optimized parameterized model function in which at least one of said assigned parameter is changed as a result of said optimization algorithm, and determining parameters of said optimized parameterized model function corresponding to the minimized cost function; and in said computer, using the determined parameters to set said system frequency and emitting electronic control signals from said computer, that include a designation of said system frequency that has been set, to said MR data acquisition scanner and operating said MR data acquisition scanner at the set system frequency in order to acquire said diagnostic MR data from said examination region.