fix: hw4 knit

This commit is contained in:
eneller
2026-05-17 12:41:24 +02:00
parent ea4aeb7bcd
commit 243547f875
3 changed files with 87 additions and 4 deletions

60
hw4.Rmd
View File

@@ -1,4 +1,15 @@
# HW 4 ---
title: "HW4"
subtitle: "Software Defined Radio"
output: pdf_document
date: "`r Sys.Date()`"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Assignment
Write an R script to calculate the output of the Klobuchar model. Write an R script to calculate the output of the Klobuchar model.
Provide a GUI means for entering input data, and the name and the Provide a GUI means for entering input data, and the name and the
path to navigation message file with coefficients of the Klobuchar path to navigation message file with coefficients of the Klobuchar
@@ -9,14 +20,20 @@ signal during 24 hours of a given day, in 1-minute increments, with
the given coefficients of the ionospheric model. Verify the correctness the given coefficients of the ionospheric model. Verify the correctness
of the algorithm implementation with a given numerical example. After of the algorithm implementation with a given numerical example. After
that, conduct a 24-hour simulation of the GPS ionospheric delay in 1- that, conduct a 24-hour simulation of the GPS ionospheric delay in 1-
minute increments for the position φu = 45.33709°, λu = 14.42496°, E minute increments for the position $\varphi_u$ = 45.33709°, $\lambda_u$ = 14.42496°, $E$
= 90°, A = 180°. Store the estimated 24-hour simulation data set in a = 90°, $A$ = 180°. Store the estimated 24-hour simulation data set in a
dedicated file on the local disc. dedicated file on the local disc.
The problem description, method, R script and implementation results The problem description, method, R script and implementation results
should be presented in a single HTML document, which should be should be presented in a single HTML document, which should be
sent to the subject teacher's e-mail by May 21, 2026 at 23:59 CEST. sent to the subject teacher's e-mail by May 21, 2026 at 23:59 CEST.
# Input
```{r select-file}
library(rstudioapi)
rinex_file <- rstudioapi::selectFile()
```
```{r read-file} ```{r read-file}
# Function to extract Klobuchar parameters from a RINEX navigation file # Function to extract Klobuchar parameters from a RINEX navigation file
@@ -49,8 +66,43 @@ extract_klobuchar_parameters <- function(rinex_file) {
) )
} }
rinex_file <- "brdc0930.26n"
klobuchar_params <- extract_klobuchar_parameters(rinex_file) klobuchar_params <- extract_klobuchar_parameters(rinex_file)
print(klobuchar_params) print(klobuchar_params)
```
```{r select-date}
# TODO
selected_date <- as.Date("2000-1-1")
```
# Klobuchar calculation
1. Calculate earth-centered angle
What are R_E and h?
$$ \psi = \pi/2 - E - \arcsin(\frac{R_E}{R_E + h} \cos(E)) $$
2. Compute the latitude of the IPP (ionospheric pierce point)
$$ \phi_I = \arcsin( sin \varphi_u \cos \psi + \cos\varphi_u \sin\psi \cos A )$$
3. Compute the longitude of the IPP
$$ \lambda_I= \lambda_u + \frac{\psi \sin A}{\cos \phi_I}$$
4. Find the geomagnetic latitude of the IPP
What is phi_P?
$$ \phi_m = \arcsin(\sin\phi_I \sin\phi_P + \cos\phi_I \cos\phi_P \cos(\lambda_I - \lambda_P)) $$
5. Find the local time at the IPP
$$ t = 43200 \lambda_I / \pi + t_{GPS} $$
$\lambda_I$ in radians, $t$ in seconds.
where $0 \leq t \leq 86 400$. Therefore:
If $t \geq 86 400$, subtract $86 400$. If $t < 0$, add $86 400$.
6. Compute the amplitude of ionospheric delay
$$ A_I = \sum_{n=0}^{3} \alpha_n(\phi_m/\pi)^n $$
If $A_I < 0$, then $A_I =0$.
```{r simulate}
# input constants
lat = 45.33709 # phi
lon = 14.42496 # lambda
E = 90
A = 180
``` ```

View File

@@ -1,4 +1,7 @@
# SDR # SDR
## Packages
signal
gsignal
## Software ## Software
https://gnss-sdr.org/docs/overview/ https://gnss-sdr.org/docs/overview/
https://gage.upc.edu/en/learning-materials/software-tools/glab-tool-suite https://gage.upc.edu/en/learning-materials/software-tools/glab-tool-suite

View File

@@ -828,6 +828,34 @@
"Maintainer": "Yihui Xie <xie@yihui.name>", "Maintainer": "Yihui Xie <xie@yihui.name>",
"Repository": "CRAN" "Repository": "CRAN"
}, },
"rstudioapi": {
"Package": "rstudioapi",
"Version": "0.18.0",
"Source": "Repository",
"Title": "Safely Access the RStudio API",
"Description": "Access the RStudio API (if available) and provide informative error messages when it's not.",
"Authors@R": "c( person(\"Kevin\", \"Ushey\", role = c(\"aut\", \"cre\"), email = \"kevin@rstudio.com\"), person(\"JJ\", \"Allaire\", role = c(\"aut\"), email = \"jj@posit.co\"), person(\"Hadley\", \"Wickham\", role = c(\"aut\"), email = \"hadley@posit.co\"), person(\"Gary\", \"Ritchie\", role = c(\"aut\"), email = \"gary@posit.co\"), person(family = \"RStudio\", role = \"cph\") )",
"Maintainer": "Kevin Ushey <kevin@rstudio.com>",
"License": "MIT + file LICENSE",
"URL": "https://rstudio.github.io/rstudioapi/, https://github.com/rstudio/rstudioapi",
"BugReports": "https://github.com/rstudio/rstudioapi/issues",
"RoxygenNote": "7.3.3",
"Suggests": [
"testthat",
"knitr",
"rmarkdown",
"clipr",
"covr",
"curl",
"jsonlite",
"withr"
],
"VignetteBuilder": "knitr",
"Encoding": "UTF-8",
"NeedsCompilation": "no",
"Author": "Kevin Ushey [aut, cre], JJ Allaire [aut], Hadley Wickham [aut], Gary Ritchie [aut], RStudio [cph]",
"Repository": "CRAN"
},
"sass": { "sass": {
"Package": "sass", "Package": "sass",
"Version": "0.4.10", "Version": "0.4.10",