def plot_all_pb(Nsamples, SNRmax, show_plot): modulations = {} modulations["QAM"] = QAM(16, 1) modulations["PAM"] = PAM(16, 1) modulations["PSK"] = PSK(16, 1) modulations["FSK"] = FSK(16, 1) for modulation_name in modulations: SNRs_estimacion, pe_estimada = modulations[ modulation_name].montecarlo_pb_vs_snr(SNRmax, Nsamples) SNRs_teoricas, pe_teorica = modulations[ modulation_name].theorical_pb_vs_snr(SNRmax) plt.plot(SNRs_teoricas, pe_teorica, label=f"{modulation_name} teórica", zorder=1) plt.scatter(SNRs_estimacion, pe_estimada, label=f"{modulation_name} estimada", zorder=2) plt.title('Probabilidades de error de bit para M=16') plt.yscale('log') plt.xlabel('SNR [dB]') plt.ylabel('log(Probabilidad de error)') plt.legend() plt.grid() plt.savefig(f'results/all_modulations.png') if show_plot: plt.show() plt.close() plt.clf()
def main(): test_string = raw_input('Please enter in a binary string:\n') signal = validate_input_string(test_string) fsk = FSK(signal) display_carrier_signal() display_digital_signal(signal, 'Original Signal') fsk.encode_wave() original_signal = fsk.decode_wave() display_digital_signal(original_signal, 'De-Modulated Signal') plt.show()
def main(): psk = PSK(signal) fsk = FSK(signal) ask = ASK(signal) psk.graph() fsk.graph() ask.graph() Carrier() OrginSignal() plt.show()