An electronic device, comprising: a device body; at least two sound generators disposed in the device body and each configured to output an audio signal; a controller disposed in the device body and connected with the at least two sound generators to control each of the sound generators to output the audio signal, wherein audio signals output by the at least two sound generators are superimposed to form a virtual sound source at a preset position, and an audio signal obtained by superimposing the audio signals output by the at least two sound generators has the largest sound intensity and the strongest directivity at the preset position; and a receiver connected with the controller, wherein each of the at least two sound generators is further configured to output an ultrasonic wave, and the receiver is configured to receive the ultrasonic wave reflected back by an external object, wherein the controller is configured to determine a distance between the external object and the electronic device based on the ultrasonic wave reflected back by the external object and received by the receiver characterized in that the device body includes a first portion and a second portion respectively disposed on both sides of a centreline extending along a width direction of the device body, and the first portion and the second portion are both provided with the sound generators; the electronic device further comprising: a first antenna module disposed at the first portion and configured to transmit or receive signals; and a second antenna module disposed at the second portion and configured to transmit or receive signals, wherein the first antenna module and the second antenna module are both connected with the controller, and the controller is configured to switch between the first antenna module and the second antenna module based on the ultrasonic wave reflected back by the external object and received by the receiver. a device body; at least two sound generators disposed in the device body and each configured to output an audio signal; a controller disposed in the device body and connected with the at least two sound generators to control each of the sound generators to output the audio signal, wherein audio signals output by the at least two sound generators are superimposed to form a virtual sound source at a preset position, and an audio signal obtained by superimposing the audio signals output by the at least two sound generators has the largest sound intensity and the strongest directivity at the preset position; and a receiver connected with the controller, wherein each of the at least two sound generators is further configured to output an ultrasonic wave, and the receiver is configured to receive the ultrasonic wave reflected back by an external object, wherein the controller is configured to determine a distance between the external object and the electronic device based on the ultrasonic wave reflected back by the external object and received by the receiver the device body includes a first portion and a second portion respectively disposed on both sides of a centreline extending along a width direction of the device body, and the first portion and the second portion are both provided with the sound generators; the electronic device further comprising: a first antenna module disposed at the first portion and configured to transmit or receive signals; and a second antenna module disposed at the second portion and configured to transmit or receive signals, wherein the first antenna module and the second antenna module are both connected with the controller, and the controller is configured to switch between the first antenna module and the second antenna module based on the ultrasonic wave reflected back by the external object and received by the receiver. a first antenna module disposed at the first portion and configured to transmit or receive signals; and a second antenna module disposed at the second portion and configured to transmit or receive signals, wherein the first antenna module and the second antenna module are both connected with the controller, and the controller is configured to switch between the first antenna module and the second antenna module based on the ultrasonic wave reflected back by the external object and received by the receiver.