1. °¢ Åë½Å¿¡ ´ëÇÑ ÃÖÀû ¼ö½Å±â¸¦ C code·Î ±¸ÇöÇÏ°í, bit error rate¸¦ ±¸ÇϽÿÀ.
0; // ¼ö½ÅµÈ ½ÅÈ£°¡ ¾ç¼ö¸é 1, À½¼ö¸é 0} double calculate_ber(int transmitted_bits, int received_bits, int num_bits) {int errors = 0;for (int i = 0; i ` num_bits; i++) {if (transmitted_bits[i] != received_bits[i]) {errors++;}}return (double)errors / num_bits; // ºñÆ® ¿À·ùÀ² °è»ê} int main{srand(time(NULL)); // ·£´ý ½Ãµå ÃʱâÈ int transmitted_bits[NUM_BITS];int received_bits[NUM_BITS];double EbN0_linear = pow(10, EbN0_dB / 10); // dB¿¡¼ ¼±Çü SNR·Î º¯È¯ // ºñÆ® »ý¼º ¹× BPSK º¯Á¶for (int i = 0; i ` NUM_BITS; i++) {transmitted_bits[i] = rand% 2; // ·£´ý ºñÆ® »ý¼º (0 ¶Ç´Â double modulated_signal = modulate_bpsk(transmitted_bits[i]);double received_signal = add_awgn(modulated_signal, EbN0_linear);received_bits[i] = demodulate_bpsk(received_signal); // ¼ö½Å ºñÆ® º¹¿ø} // ºñÆ® ¿À·ùÀ² °è»êdouble ber = calculate_ber(transmitted_bits, received_bits, NUM_BITS);printf(`Bit Error Rate (BER) %lf\n`, ber); return 0;}``` ¡¦(»ý·«)
|