This study aims to analyze the NRZ-OOK modulation format in free-space optical communication. Simulations were conducted to examine the influence of the SpS parameter and optical signal power at the input modulator on the average power of the modulated optical signal. The research employed a computer simulation approach, where the optical signal was transmitted through an optical path without cables, enabling fast data transmission and longer distances compared to wired media. The method used specifically uses a machine learning-based application, Python. The simulation results indicate that higher SpS values result in a more accurate and smoother optical signal representation. Furthermore, an increase in the optical signal power at the input modulator increases the average power of the modulated optical signal. However, negative optical power values do not hold any relevant physical meaning. The magnitude of the Pi_dBm value also affects the optical signal spectrum, with higher optical power generating more robust frequency components. Graphs with negative optical power exhibit significant noise due to distortion and non-linearity. The findings of this study provide a better understanding of the influence of these parameters in the NRZ-OOK modulation format for free-space optical communication.