From f40e284218890c17a48ff35227862c3e777e29b4 Mon Sep 17 00:00:00 2001 From: eneller Date: Sun, 17 May 2026 16:09:04 +0200 Subject: [PATCH] hw4 functions --- hw4.Rmd | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/hw4.Rmd b/hw4.Rmd index ebd251c..ef02c45 100644 --- a/hw4.Rmd +++ b/hw4.Rmd @@ -149,11 +149,12 @@ $\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$. ```{r klob-5} -tGPS = 1 # TODO -t = 43200 * lambda_I / pi + tGPS +t <- function(tGPS){ + 43200 * lambda_I / pi + tGPS +} ``` ```{r klob-5-demo} -t +t(1) ``` ### 6. Compute the amplitude of ionospheric delay @@ -188,10 +189,12 @@ P_I $$ X_I = \frac{2\pi ( t-50400)}{P_I}$$ ```{r klob-8} -X_I = (2 * pi * (t-50400))/P_I +X_I <- function(tGPS){ + (2 * pi * (t(tGPS)-50400))/P_I +} ``` ```{r klob-8-demo, echo=FALSE} -X_I +X_I(1) ``` ### 9. Compute the slant factor (ionospheric mapping function) @@ -214,15 +217,34 @@ I_1 = \begin{cases} $$ ```{r klob-10} -if (abs(X_I)< pi/2) { - I_1 = (5e-9 + A_I * cos(X_I)) * F -}else{ - I_1 = 5e-9 * F +I_1 <- function(tGPS){ + if (abs(X_I(tGPS))< pi/2) { + I_1 = (5e-9 + A_I * cos(X_I(tGPS))) * F + }else{ + I_1 = 5e-9 * F + } +I_1 } ``` ```{r klob-10-demo, echo=FALSE} -I_1 +I_1(1) ``` The delay $I_1$ is given in seconds and is referred to the GPS L1 or Beidou B1 frequencies. + +# 24-hour simulation +```{r simulate} +xs <- seq(from = 0, to = 24*60, by = 1) +ys <- numeric(length(xs)) +for (x in xs){ + y <- I_1(x*60) + ys[x] <- y +} +``` + +```{r simulate-demo, echo=FALSE} +head(ys) +plot(xs,ys,xlab="Time of Day [Minutes]",ylab="Delay [s]") + +``` \ No newline at end of file