-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ErikBuer/docs-enhancement
Integrate doctest and enhanced examples
- Loading branch information
Showing
15 changed files
with
457 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: DocumentationDryRun | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1.6' | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
- name: Build and deploy | ||
run: julia --project=docs/ docs/make.jl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ | |
*.log | ||
Manifest.toml | ||
docs/build/ | ||
|
||
*.vscode/ | ||
*.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
[deps] | ||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" | ||
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
# Transmission of xQAM with additive white Gaussian noise | ||
# Transmission of xQAM with additive white Gaussian noise | ||
|
||
To simulate a transmission of QPSK // 16QAM // 64QAM // 256QAM other a | ||
white additive Gaussian noise and display the received constellation, | ||
the following code can be used | ||
|
||
# ---------------------------------------------------- | ||
# --- Transmitter | ||
# ---------------------------------------------------- | ||
using DigitalComm | ||
using Plots | ||
# --- Parameters | ||
snr = 20; | ||
mcs = 16; | ||
nbBits = 1024* Int(log2(mcs)); | ||
# --- Binary sequence generation | ||
bitSeq = genBitSequence(nbBits); | ||
# --- QPSK mapping | ||
qamSeq = bitMappingQAM(mcs,bitSeq); | ||
# ---------------------------------------------------- | ||
# --- Channel | ||
# ---------------------------------------------------- | ||
# --- AWGN | ||
# Theoretical power is 1 (normalized constellation) | ||
qamNoise, = addNoise(qamSeq,snr,1); | ||
# ---------------------------------------------------- | ||
# --- Rx Stage: SRRC | ||
# ---------------------------------------------------- | ||
# --- Binary demapper | ||
bitDec = bitDemappingQAM(mcs,qamNoise); | ||
# --- BER measure | ||
ber = sum(xor.(bitDec,bitSeq)) /length(bitSeq); | ||
# --- Display constellation | ||
plt = scatter(real(qamNoise),imag(qamNoise),label="Noisy"); | ||
scatter!(plt,real(qamSeq),imag(qamSeq),label="Ideal"); | ||
xlabel!("Real part"); | ||
ylabel!("Imag part"); | ||
display(plt); | ||
|
||
It plots the received constellation impaired by noise (here a 20dB SNR is used) | ||
![Constellation](./../img/constellation.png) | ||
the following code can be used | ||
|
||
## Transmitter | ||
|
||
```@example AWG | ||
using ..DigitalComm # hide | ||
using Plots | ||
# --- Parameters | ||
snr = 20; | ||
mcs = 16; | ||
nbBits = 1024* Int(log2(mcs)); | ||
# --- Binary sequence generation | ||
bitSeq = genBitSequence(nbBits); | ||
# --- QPSK mapping | ||
qamSeq = bitMappingQAM(mcs,bitSeq); nothing | ||
``` | ||
|
||
## Channel | ||
|
||
```@example AWG | ||
# --- AWGN | ||
# Theoretical power is 1 (normalized constellation) | ||
qamNoise, = addNoise(qamSeq,snr,1); nothing | ||
``` | ||
|
||
## Recevicer | ||
|
||
```@example AWG | ||
# --- Binary demapper | ||
bitDec = bitDemappingQAM(mcs,qamNoise); | ||
# --- BER measure | ||
ber = sum(xor.(bitDec,bitSeq)) /length(bitSeq); | ||
# --- Display constellation | ||
plt = scatter(real(qamNoise),imag(qamNoise),label="Noisy"); | ||
scatter(plt,real(qamSeq),imag(qamSeq),label="Ideal"); | ||
xlabel!("Real part"); | ||
ylabel!("Imag part"); | ||
savefig("constellation.svg"); nothing # hide | ||
``` | ||
|
||
It plots the received constellation impaired by noise (here a 20dB SNR is used) | ||
![Constellation](constellation.svg) |
Oops, something went wrong.