Skip to content

Commit

Permalink
Fix cn0 estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
zsoerenm committed Jan 24, 2020
1 parent b43066f commit fefe6fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
@@ -1,7 +1,7 @@
name = "Tracking"
uuid = "10b2438b-ffd4-5096-aa58-44041d5c8f3b"
authors = ["Soeren Zorn <soeren.zorn@nav.rwth-aachen.de>"]
version = "0.11.0"
version = "0.11.1"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -29,7 +29,7 @@ using Tracking
using Tracking: Hz, GPSL1
carrier_doppler = 1000Hz
code_phase = 50
sample_frequency = 2.5MHz
sample_frequency = 2.5e6Hz
prn = 1
state = TrackingState(GPSL1, carrier_doppler, code_phase)
results = track(signal, state, prn, sample_frequency)
Expand Down
4 changes: 3 additions & 1 deletion src/cn0_estimation.jl
Expand Up @@ -42,6 +42,8 @@ function estimate_cn0(cn0_estimator::MomentsCN0Estimator, integration_time)
M₂ = 1 / length(cn0_estimator) * sum(abs2_prompt_buffer)
M₄ = 1 / length(cn0_estimator) * sum(abs2_prompt_buffer .^ 2)
Pd = sqrt(abs(2 * M₂^2 - M₄))
SNR = Pd / (M₂ - Pd)
noise_power = (M₂ - Pd)
noise_power_non_neg = noise_power - 2 * (noise_power < 0) * noise_power
SNR = Pd / noise_power_non_neg
dBHz(SNR / integration_time)
end

2 comments on commit fefe6fc

@zsoerenm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8364

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.1 -m "<description of version>" fefe6fc4919e420108ecb585f6cbe569434ac7a8
git push origin v0.11.1

Please sign in to comment.