All perfect praise be to Allaah, the Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Masturbation is unlawful at any time. Also, it is an act that breaks the fast. If the initiated ejaculation occurred after the Athaan of Fajr was pronounced and you did it intentionally, knew it was unlawful, and were conscious of that you were fasting and that the Athaan was being pronounced, then this means that you broke your fast and it has become due upon you to make up for the fast of that day. However, if you did so while being forgetful of the fact that you were fasting, then your fasting on that day was valid.
What appears from your question is that you were forgetful. However, it would be better if you make up for the fast of that day to be on the safe side.
Furthermore, you must fear Allaah and avoid this incorrect practice during Ramadan and at any other time, since masturbation is prohibited at any time, and it becomes even more unlawful during Ramadan, for it violates its sanctity. Indeed, a sin is aggravated according to the time and place in which it is committed, to say nothing of harmful effects resulting from this prohibited practice. The expiation for it is true repentance, which is realized by three things: to give up the sin, to be determined not to return to it ever again, and to regret having done it.
Allaah Knows best.