📄 exporoutput.cpp
字号:
/**********************************************/
/* Export the BER & FER
/* int ExportFerF(struct BasicParaS * ctrl, double ber, double Eb_No_dB)
/* Written by: Ouyang Ziyue,
/* Date: Jun 20, 2007,
/* Function: It writes the BER into the log file
/* Input parameter:
/* The ber is the BER of the current simulation
/* The Eb_No_dB is the Eb/No or SNR of the current simulation
/* Output parameter:
/* The return value is a flag to indicate whether the function is executed successfully.
/* Note:
/* ctrl should be built before this function is called,
/**********************************************/
#include "parameter_sets.h"
int ExportOutputF(struct BasicParaS * ctrl, double ber,double fer,double throughput, double Eb_No_dB)
{
FILE * fpOut = fopen("output.txt", "a");
if (ctrl->noiseMode == 0) // Eb/No
{
fprintf(fpOut, "When Eb_No is %.2fdB, the BER is %E\n", Eb_No_dB, ber);
printf("When Eb_No is %.2fdB, the BER is %E\n", Eb_No_dB, ber);
fprintf(fpOut, "When Eb_No is %.2fdB, the FER is %E\n", Eb_No_dB, fer);
printf("When Eb_No is %.2fdB, the FER is %E\n", Eb_No_dB, fer);
fprintf(fpOut, "When Eb_No is %.2fdB, the numIter is %E\n", Eb_No_dB, ctrl->numIter);
printf("When Eb_No is %.2fdB, the numIter is %E\n", Eb_No_dB, ctrl->numIter);
fprintf(fpOut, "When Eb_No is %.2fdB, the throughput is %E\n", Eb_No_dB, throughput);
printf("When Eb_No is %.2fdB, the throughput is %E\n", Eb_No_dB, throughput);
}
else
{
fprintf(fpOut, "When SNR is %.2fdB, the BER is %E\n", Eb_No_dB, ber);
printf("When SNR is %.2fdB, the BER is %E\n", Eb_No_dB, ber);
fprintf(fpOut, "When Eb_No is %.2fdB, the FER is %E\n", Eb_No_dB, fer);
printf("When Eb_No is %.2fdB, the FER is %E\n", Eb_No_dB, fer);
fprintf(fpOut, "When SNR is %.2fdB, the numIter is %E\n", Eb_No_dB, ctrl->numIter);
printf("When SNR is %.2fdB, the numIter is %E\n", Eb_No_dB, ctrl->numIter);
fprintf(fpOut, "When SNR is %.2fdB, the throughput is %E\n", Eb_No_dB, throughput);
printf("When SNR is %.2fdB, the throughput is %E\n", Eb_No_dB, throughput);
}
fclose(fpOut);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -