김보민

change channel

No preview for this file type
1 +#include <iostream>
2 +#include "channel.h"
3 +#include "variables.h"
4 +#include <random>
5 +#include <ctime>
6 +using namespace std;
7 +
8 +
9 +Cchannel::Cchannel()
10 +{
11 +}
12 +
13 +void Cchannel::AWGN()
14 +{
15 + srand((unsigned int)time(NULL));
16 +
17 + for (int i = 0; i < 10000; i++)
18 + {
19 + default_random_engine generator(rand());
20 + normal_distribution<double> myGauss(0, (float)No / 2);
21 + number = myGauss(generator);
22 + r[i] = s[i] + number;
23 + }
24 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -10,5 +10,6 @@ public: ...@@ -10,5 +10,6 @@ public:
10 float *s; // trasmitted signal 10 float *s; // trasmitted signal
11 float r[Nbits / Nbitspersymbol*Nsamplespersymbol]; // corrupted signal 11 float r[Nbits / Nbitspersymbol*Nsamplespersymbol]; // corrupted signal
12 void AWGN(); 12 void AWGN();
13 + double number;
13 }; 14 };
14 #endif 15 #endif
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -21,32 +21,32 @@ ...@@ -21,32 +21,32 @@
21 <PropertyGroup Label="Globals"> 21 <PropertyGroup Label="Globals">
22 <ProjectGuid>{6FF25C27-45BF-4502-A1F8-0EFB069E1515}</ProjectGuid> 22 <ProjectGuid>{6FF25C27-45BF-4502-A1F8-0EFB069E1515}</ProjectGuid>
23 <RootNamespace>constellation</RootNamespace> 23 <RootNamespace>constellation</RootNamespace>
24 - <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> 24 + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
25 </PropertyGroup> 25 </PropertyGroup>
26 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> 26 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28 <ConfigurationType>Application</ConfigurationType> 28 <ConfigurationType>Application</ConfigurationType>
29 <UseDebugLibraries>true</UseDebugLibraries> 29 <UseDebugLibraries>true</UseDebugLibraries>
30 - <PlatformToolset>v141</PlatformToolset> 30 + <PlatformToolset>v142</PlatformToolset>
31 <CharacterSet>MultiByte</CharacterSet> 31 <CharacterSet>MultiByte</CharacterSet>
32 </PropertyGroup> 32 </PropertyGroup>
33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34 <ConfigurationType>Application</ConfigurationType> 34 <ConfigurationType>Application</ConfigurationType>
35 <UseDebugLibraries>false</UseDebugLibraries> 35 <UseDebugLibraries>false</UseDebugLibraries>
36 - <PlatformToolset>v141</PlatformToolset> 36 + <PlatformToolset>v142</PlatformToolset>
37 <WholeProgramOptimization>true</WholeProgramOptimization> 37 <WholeProgramOptimization>true</WholeProgramOptimization>
38 <CharacterSet>MultiByte</CharacterSet> 38 <CharacterSet>MultiByte</CharacterSet>
39 </PropertyGroup> 39 </PropertyGroup>
40 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
41 <ConfigurationType>Application</ConfigurationType> 41 <ConfigurationType>Application</ConfigurationType>
42 <UseDebugLibraries>true</UseDebugLibraries> 42 <UseDebugLibraries>true</UseDebugLibraries>
43 - <PlatformToolset>v141</PlatformToolset> 43 + <PlatformToolset>v142</PlatformToolset>
44 <CharacterSet>MultiByte</CharacterSet> 44 <CharacterSet>MultiByte</CharacterSet>
45 </PropertyGroup> 45 </PropertyGroup>
46 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
47 <ConfigurationType>Application</ConfigurationType> 47 <ConfigurationType>Application</ConfigurationType>
48 <UseDebugLibraries>false</UseDebugLibraries> 48 <UseDebugLibraries>false</UseDebugLibraries>
49 - <PlatformToolset>v141</PlatformToolset> 49 + <PlatformToolset>v142</PlatformToolset>
50 <WholeProgramOptimization>true</WholeProgramOptimization> 50 <WholeProgramOptimization>true</WholeProgramOptimization>
51 <CharacterSet>MultiByte</CharacterSet> 51 <CharacterSet>MultiByte</CharacterSet>
52 </PropertyGroup> 52 </PropertyGroup>
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
115 <ClCompile Include="sender.cpp"> 115 <ClCompile Include="sender.cpp">
116 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> 116 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
117 </ClCompile> 117 </ClCompile>
118 + <ClCompile Include="channel.cpp" />
118 </ItemGroup> 119 </ItemGroup>
119 <ItemGroup> 120 <ItemGroup>
120 <ClInclude Include="channel.h" /> 121 <ClInclude Include="channel.h" />
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
24 <ClCompile Include="sender.cpp"> 24 <ClCompile Include="sender.cpp">
25 <Filter>소스 파일</Filter> 25 <Filter>소스 파일</Filter>
26 </ClCompile> 26 </ClCompile>
27 + <ClCompile Include="channel.cpp">
28 + <Filter>소스 파일</Filter>
29 + </ClCompile>
27 </ItemGroup> 30 </ItemGroup>
28 <ItemGroup> 31 <ItemGroup>
29 <ClInclude Include="sender.h"> 32 <ClInclude Include="sender.h">
......