iccsa-21-wind

git clone https://git.igankevich.com/iccsa-21-wind.git
Log | Files | Refs

commit f572edf86166de8aac7a7c5df0301a2501273a31
parent c95a535beb32438aacac66c74dc0b891f07bcd99
Author: Ivan Gankevich <i.gankevich@spbu.ru>
Date:   Tue,  6 Apr 2021 19:04:55 +0300

ACF fitting.

Diffstat:
Makefile | 1+
R/acf-min-max.R | 38++++++++++++++++++++++++++++++++++++++
R/anal.R | 142++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
R/minmax.R | 50++++++++++++++++++++++++++++++++++++++++++++++++++
gnuplot/acf.gnuplot | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
main.tex | 19+++++++++++++++++--
6 files changed, 303 insertions(+), 36 deletions(-)

diff --git a/Makefile b/Makefile @@ -21,6 +21,7 @@ build/main.pdf: build/gnuplot/velocity-dist.eps build/main.pdf: build/gnuplot/velocity-xy-dist-max.eps build/main.pdf: build/gnuplot/velocity-xy-dist-min.eps build/main.pdf: build/gnuplot/direction-dist.eps +build/main.pdf: build/gnuplot/acf.eps #build/main.pdf: build/gnuplot/anemometer.eps #build/main.pdf: build/gnuplot/anemometer.svg build/main.pdf: diff --git a/R/acf-min-max.R b/R/acf-min-max.R @@ -0,0 +1,38 @@ +source("R/common.R") + +time_delta = 60*60*2 +for (timestamp in c(1614920400, 1615388400, 1614135600, 1616058000, 1614430800, 1614452400)) { + velocity <- select_samples(timestamp, timestamp+time_delta) + path <- file.path('build', 'acf') + dir.create(path, recursive=TRUE) + filename <- file.path(path, sprintf("%d-hist-xy", timestamp)) + print(filename) + # add corner points with mean speed + ## v1 + #x_max = max(abs(velocity$x)) + #y_max = max(abs(velocity$y)) + #s = mean(velocity$speed) + #r = sqrt(x_max**2 + y_max**2) + #tmp <- data.frame(x=c(velocity$x/r,r,-r,-r,r), + # y=c(velocity$y/r,r,r,-r,-r), + # r=c(velocity$speed,s,s,s,s)) + #tmp <- tmp[order(tmp$r),] # order by speed for gnuplot + #write.table(tmp, filename, row.names=FALSE, quote=FALSE) + +# write.table(data.frame(x=velocity$x, +# y=velocity$y, +# r=velocity$speed), +# filename, row.names=FALSE, quote=FALSE) + + # v2 + hist_xy <- hist2d(velocity$x, velocity$y, same.scale=TRUE, show=TRUE, nbins=400) + grid_xy <- expand.grid(x=-hist_xy$x,y=-hist_xy$y) + x_max = max(abs(grid_xy$x)) + y_max = max(abs(grid_xy$y)) + r = sqrt(x_max**2 + y_max**2) + write.table(data.frame(x=c(grid_xy$x/r,r,-r,-r,r), + y=c(grid_xy$y/r,r,r,-r,-r), + r=c(as.vector(t(hist_xy$counts)),0,0,0,0)), + filename, row.names=FALSE, quote=FALSE) +} + diff --git a/R/anal.R b/R/anal.R @@ -286,22 +286,61 @@ fit_velocity_pdf_v2 <- function (x, sign=-1, plot=TRUE, axis="x") { coef(fit) } -fit_velocity_acf <- function (x, plot=TRUE, axis="x") { - acf_x <- acf(x, type="correlation", plot=FALSE) - acf_x <- data.frame(acf=acf_x$acf, lag=acf_x$lag/(nrow(acf_x$lag)-1)) - model <- nls(acf ~ a*exp(-(b*lag)**c), +fit_velocity_acf <- function (velocity, plot=TRUE, axis="x", timestamp=0, write=TRUE) { + acf_x <- acf(velocity, type="covariance", plot=FALSE) + acf_x <- data.frame(acf=acf_x$acf, lag=acf_x$lag) + model <- nls(acf ~ a*exp(-abs(b*lag)**c), data=acf_x, start=list(a=1,b=1,c=1), control=list(warnOnly=TRUE), algorithm="port", - lower=c(0.1,0,0.1), upper=c(20,1000,2)) + lower=c(0,0,1e-6), upper=c(1000,1000,10)) c <- summary(model)$coefficients + acf_est <- c[[1]]*exp(-abs(c[[2]]*acf_x$lag)**c[[3]]) if (plot) { - acf_est <- sapply(acf_x$lag, function (lag) { c[[1]]*exp(-(c[[2]]*lag)**c[[3]]) }) plot(acf_x$lag, acf_x$acf, xlab='Lag', ylab=paste('ACF', axis)) lines(acf_x$lag, acf_est, col='red') } - c + if (write) { + path <- file.path('build', 'acf', axis) + dir.create(path, recursive=TRUE) + filename <- file.path(path, sprintf("%d", timestamp)) + write.table(data.frame(lag=acf_x$lag,actual=acf_x$acf,estimated=acf_est), + filename, row.names=FALSE, quote=FALSE) + } + list(coefficients=c, + rmse=rmse(acf_est,acf_x$acf), + lag=acf_x$lag, + actual=acf_x$acf, + estimated=acf_est) +} + +fit_velocity_acf_bilateral <- function (velocity, axis="x", timestamp=0, plot=TRUE) { + v = velocity + model_1 <- fit_velocity_acf(v[v<=0], axis=axis, timestamp=timestamp, plot=FALSE, write=FALSE); + model_2 <- fit_velocity_acf(v[v>=0], axis=axis, timestamp=timestamp, plot=FALSE, write=FALSE); + #x <- c(dist_left$x, dist_right$x) + lag <- c(-model_1$lag, model_2$lag) + estimated <- c(model_1$estimated, model_2$estimated) + actual <- c(model_1$actual, model_2$actual) + plot(lag, actual, xlab='Lag', ylab='ACF') + lines(-model_1$lag, model_2$estimated, col='red', lwd=2) + lines(model_2$lag, model_2$estimated, col='blue', lwd=2) + path <- file.path('build', 'acf', axis) + dir.create(path, recursive=TRUE) + filename <- file.path(path, sprintf("%d", timestamp)) + #write.table(data.frame(lag=lag,actual=actual,estimated=estimated), + # filename, row.names=FALSE, quote=FALSE) + write.table(data.frame(lag=model_1$lag,actual=model_1$actual,estimated=model_1$estimated), + filename, row.names=FALSE, quote=FALSE) + write("\n",file=filename,append=TRUE) + write.table(data.frame(lag=model_2$lag,actual=model_2$actual,estimated=model_2$estimated), + filename, row.names=FALSE, quote=FALSE, append=TRUE) + list(coefficients=model_1$coefficients, + rmse=rmse(estimated,actual), + lag=lag, + actual=actual, + estimated=estimated) } fit_direction <- function (theta, density, plot=TRUE, sign=-1) { @@ -383,17 +422,21 @@ timestamps <- seq(time_start, time_end, time_delta) cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling='remove') %dopar% { cumulative_data <- data.frame(speed=numeric(0),direction=numeric(0), x_mode=numeric(0),abs_x_mode=numeric(0),x_sd=numeric(0), - y_mean=numeric(0), - acf_x_a=numeric(0),acf_x_b=numeric(0),acf_x_c=numeric(0), + y_mean=numeric(0),v_mean=numeric(0),d_mean=numeric(0), x_a=numeric(0),x_b=numeric(0),x_c=numeric(0), x_d=numeric(0),x_e=numeric(0),x_f=numeric(0), # Y y_mode=numeric(0), y_a=numeric(0),y_b=numeric(0),y_c=numeric(0), y_d=numeric(0),y_e=numeric(0),y_f=numeric(0), - acf_y_a=numeric(0),acf_y_b=numeric(0),acf_y_c=numeric(0), timestamp=numeric(0), - x_rmse=numeric(0), y_rmse=numeric(0), z_rmse=numeric(0)) + x_rmse=numeric(0), y_rmse=numeric(0), z_rmse=numeric(0), + acf_x_rmse=numeric(0), acf_y_rmse=numeric(0), acf_z_rmse=numeric(0), + acf_x_a=numeric(0),acf_x_b=numeric(0),acf_x_c=numeric(0), + acf_y_a=numeric(0),acf_y_b=numeric(0),acf_y_c=numeric(0), + acf_z_a=numeric(0),acf_z_b=numeric(0),acf_z_c=numeric(0), + acf_v_a=numeric(0),acf_v_b=numeric(0),acf_v_c=numeric(0), + acf_d_a=numeric(0),acf_v_b=numeric(0),acf_v_c=numeric(0)) velocity <- select_samples(timestamp, time_delta) if (nrow(velocity) == 0) { return(NULL) } filename <- sprintf("build/rplot-%d.pdf", timestamp) @@ -441,14 +484,31 @@ cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling z_model <- fit_velocity_pdf_bilateral(velocity$z, axis="z", timestamp=timestamp, dist="weibull") cumulative_data[new_row, "z_rmse"] = z_model$rmse # ACF X - x_coefs <- fit_velocity_acf(velocity$x, plot=TRUE, axis="x") - cumulative_data[new_row, "acf_x_a"] = x_coefs[[1]] - cumulative_data[new_row, "acf_x_b"] = x_coefs[[2]] - cumulative_data[new_row, "acf_x_c"] = x_coefs[[3]] - y_coefs <- fit_velocity_acf(velocity$y, plot=TRUE, axis="y") - cumulative_data[new_row, "acf_y_a"] = y_coefs[[1]] - cumulative_data[new_row, "acf_y_b"] = y_coefs[[2]] - cumulative_data[new_row, "acf_y_c"] = y_coefs[[3]] + x_model <- fit_velocity_acf_bilateral(velocity$x, plot=TRUE, axis="x", timestamp=timestamp) + cumulative_data[new_row, "acf_x_a"] = x_model$coefficients[[1]] + cumulative_data[new_row, "acf_x_b"] = x_model$coefficients[[2]] + cumulative_data[new_row, "acf_x_c"] = x_model$coefficients[[3]] + cumulative_data[new_row, "acf_x_rmse"] = x_model$rmse + y_model <- fit_velocity_acf_bilateral(velocity$y, plot=TRUE, axis="y", timestamp=timestamp) + cumulative_data[new_row, "acf_y_a"] = y_model$coefficients[[1]] + cumulative_data[new_row, "acf_y_b"] = y_model$coefficients[[2]] + cumulative_data[new_row, "acf_y_c"] = y_model$coefficients[[3]] + cumulative_data[new_row, "acf_y_rmse"] = y_model$rmse + z_model <- fit_velocity_acf_bilateral(velocity$z, plot=TRUE, axis="z", timestamp=timestamp) + cumulative_data[new_row, "acf_z_a"] = z_model$coefficients[[1]] + cumulative_data[new_row, "acf_z_b"] = z_model$coefficients[[2]] + cumulative_data[new_row, "acf_z_c"] = z_model$coefficients[[3]] + cumulative_data[new_row, "acf_z_rmse"] = z_model$rmse + v_model <- fit_velocity_acf(velocity$speed, plot=TRUE, axis="speed", timestamp=timestamp) + cumulative_data[new_row, "acf_v_a"] = v_model$coefficients[[1]] + cumulative_data[new_row, "acf_v_b"] = v_model$coefficients[[2]] + cumulative_data[new_row, "acf_v_c"] = v_model$coefficients[[3]] + cumulative_data[new_row, "acf_v_rmse"] = v_model$rmse + d_model <- fit_velocity_acf(velocity$direction, plot=TRUE, axis="direction", timestamp=timestamp) + cumulative_data[new_row, "acf_d_a"] = d_model$coefficients[[1]] + cumulative_data[new_row, "acf_d_b"] = d_model$coefficients[[2]] + cumulative_data[new_row, "acf_d_c"] = d_model$coefficients[[3]] + cumulative_data[new_row, "acf_d_rmse"] = d_model$rmse direction_model <- fit_direction_bilateral(velocity$direction, timestamp=timestamp) cumulative_data[new_row, "direction_rmse"] = direction_model$rmse @@ -456,18 +516,18 @@ cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling old_mar = par("mar") direction_hist <- hist(velocity$direction, plot=FALSE, breaks=100) direction_hist <- data.frame(direction=direction_hist$density, angle=direction_hist$mids) - path <- file.path('build', 'direction') - dir.create(path, recursive=TRUE) - filename <- file.path(path, sprintf("%d-hist-xy", timestamp)) - # add corner points with mean speed - x_max = max(abs(velocity$x)) - y_max = max(abs(velocity$y)) - s = mean(velocity$speed) - r = sqrt(x_max**2 + y_max**2) - write.table(data.frame(x=c(velocity$x/r,r,-r,-r,r), - y=c(velocity$y/r,r,r,-r,-r), - r=c(velocity$speed,s,s,s,s)), - filename, row.names=FALSE, quote=FALSE) + #path <- file.path('build', 'direction') + #dir.create(path, recursive=TRUE) + #filename <- file.path(path, sprintf("%d-hist-xy", timestamp)) + ## add corner points with mean speed + #x_max = max(abs(velocity$x)) + #y_max = max(abs(velocity$y)) + #s = mean(velocity$speed) + #r = sqrt(x_max**2 + y_max**2) + #write.table(data.frame(x=c(velocity$x/r,r,-r,-r,r), + # y=c(velocity$y/r,r,r,-r,-r), + # r=c(velocity$speed,s,s,s,s)), + # filename, row.names=FALSE, quote=FALSE) #hist_xy <- hist2d(velocity$x, velocity$y, same.scale=TRUE, show=TRUE) #grid_xy <- expand.grid(x=hist_xy$x,y=hist_xy$y) #x_max = max(abs(grid_xy$x)) @@ -483,6 +543,8 @@ cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling cumulative_data[new_row, "abs_x_mode"] = abs(x_mode) cumulative_data[new_row, "x_sd"] = sd(velocity$x) cumulative_data[new_row, "y_mean"] = mean(velocity$y) + cumulative_data[new_row, "v_mean"] = mean(velocity$speed) + cumulative_data[new_row, "d_mean"] = mean(velocity$direction) #i <- i + 1 #setTxtProgressBar(pb, i) dev.off() @@ -490,10 +552,12 @@ cumulative_data <- foreach (timestamp=timestamps, .combine=rbind, .errorhandling } #close(pb) -rmse_table <- cumulative_data[c("timestamp","x_rmse","y_rmse","z_rmse","speed","direction_rmse","direction")] -write.table(rmse_table, "build/daily-rmse", row.names=FALSE, quote=FALSE) +#rmse_table <- cumulative_data[c("timestamp","x_rmse","y_rmse","z_rmse","speed", +# "direction_rmse","direction", +# "acf_x_rmse","acf_y_rmse","acf_z_rmse")] +write.table(cumulative_data, "build/daily-rmse", row.names=FALSE, quote=FALSE) #print(cumulative_data) -#print(summary(cumulative_data)) +print(summary(cumulative_data)) model <- nls(x_sd ~ a*speed+b, data=cumulative_data, control=list(warnOnly=TRUE), @@ -504,6 +568,16 @@ x_sd_est <- sapply(cumulative_data$speed, function (x) { coefs[[1]]*x + coefs[[2 plot(cumulative_data$speed, cumulative_data$x_sd) lines(cumulative_data$speed, x_sd_est, col='red') +plot(cumulative_data$acf_x_a, cumulative_data$x_sd) +plot(log(cumulative_data$acf_x_b), cumulative_data$x_sd) +plot(cumulative_data$acf_x_c, cumulative_data$x_sd) +#plot(cumulative_data$acf_v_a, cumulative_data$v_mean) +#plot(log(cumulative_data$acf_v_b), cumulative_data$v_mean) +#plot(cumulative_data$acf_v_c, cumulative_data$v_mean) +#plot(cumulative_data$acf_d_a, cumulative_data$d_mean) +#plot(cumulative_data$acf_d_b, cumulative_data$d_mean) +#plot(cumulative_data$acf_d_c, cumulative_data$d_mean) + plot(cumulative_data$abs_x_mode, cumulative_data$acf_x_b) #plot(cumulative_data$acf_x_b, cumulative_data$y_mean/tan(cumulative_data$direction)) #plot(cumulative_data$speed, cumulative_data$acf_x_b) diff --git a/R/minmax.R b/R/minmax.R @@ -44,3 +44,53 @@ printf("Max. direction RMSE = %f (%s), mean direction = %f, mean speed = %f\n", direction_rmse_max["direction"], direction_rmse_max["speed"]) printf("Mean direction RMSE = %f\n", direction_rmse_mean) + +filename <- "build/gnuplot/acf_rmse.gnuplot" +cat("",file=filename) +gnuplot <- function (str, ...) { + cat(sprintf(str, ...), file=filename, append=TRUE) +} +with(list(tmp = data[data$acf_x_rmse == min(data$acf_x_rmse), ]), + { + gnuplot("acf_x_rmse_min = %f\n", tmp["acf_x_rmse"]) + gnuplot("acf_x_rmse_min_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_x_rmse_min_speed = %f\n", tmp["speed"]) + printf("ACF X min. RMSE = %f (%s), mean speed = %f\n", + tmp["acf_x_rmse"], tmp["timestamp"], tmp["speed"]) + }) +with(list(tmp = data[data$acf_y_rmse == min(data$acf_y_rmse), ]), + { + gnuplot("acf_y_rmse_min = %f\n", tmp["acf_y_rmse"]) + gnuplot("acf_y_rmse_min_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_y_rmse_min_speed = %f\n", tmp["speed"]) + printf("ACF Y min. RMSE = %f (%s), mean speed = %f\n", + tmp["acf_y_rmse"], tmp["timestamp"], tmp["speed"]) + }) +with(list(tmp = data[data$acf_z_rmse == min(data$acf_z_rmse), ]), + { + gnuplot("acf_z_rmse_min = %f\n", tmp["acf_z_rmse"]) + gnuplot("acf_z_rmse_min_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_z_rmse_min_speed = %f\n", tmp["speed"]) + printf("ACF Z min. RMSE = %f (%s), mean speed = %f\n", tmp["acf_z_rmse"], tmp["timestamp"], tmp["speed"]) + }) +with(list(tmp = data[data$acf_x_rmse == max(data$acf_x_rmse), ]), + { + gnuplot("acf_x_rmse_max = %f\n", tmp["acf_x_rmse"]) + gnuplot("acf_x_rmse_max_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_x_rmse_max_speed = %f\n", tmp["speed"]) + printf("ACF X max. RMSE = %f (%s), mean speed = %f\n", tmp["acf_x_rmse"], tmp["timestamp"], tmp["speed"]) + }) +with(list(tmp = data[data$acf_y_rmse == max(data$acf_y_rmse), ]), + { + gnuplot("acf_y_rmse_max = %f\n", tmp["acf_y_rmse"]) + gnuplot("acf_y_rmse_max_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_y_rmse_max_speed = %f\n", tmp["speed"]) + printf("ACF Y max. RMSE = %f (%s), mean speed = %f\n", tmp["acf_y_rmse"], tmp["timestamp"], tmp["speed"]) + }) +with(list(tmp = data[data$acf_z_rmse == max(data$acf_z_rmse), ]), + { + gnuplot("acf_z_rmse_max = %f\n", tmp["acf_z_rmse"]) + gnuplot("acf_z_rmse_max_timestamp = %d\n", as.integer(tmp["timestamp"])) + gnuplot("acf_z_rmse_max_speed = %f\n", tmp["speed"]) + printf("ACF Z max. RMSE = %f (%s), mean speed = %f\n", tmp["acf_z_rmse"], tmp["timestamp"], tmp["speed"]) + }) diff --git a/gnuplot/acf.gnuplot b/gnuplot/acf.gnuplot @@ -0,0 +1,89 @@ +# ACF X min. RMSE = 0.003198 (1614920400), mean speed = 3.230443 +# ACF Y min. RMSE = 0.004612 (1615388400), mean speed = 1.435405 +# ACF Z min. RMSE = 0.001059 (1614135600), mean speed = 2.748603 +# ACF X max. RMSE = 0.178318 (1616058000), mean speed = 3.347379 +# ACF Y max. RMSE = 0.222642 (1614430800), mean speed = 3.308343 +# ACF Z max. RMSE = 0.058600 (1614452400), mean speed = 2.643957 + +set terminal svg size 450,450/3*2 font 'Free Serif, 10' enhanced round dynamic +set xrange [-40:40] +set xtics 0,20,40 nomirror out offset 0,0.5 add ('20' -20, '40' -40) +set ytics nomirror out offset 0.5,0 +set border 1+2 back +#set key top center outside Left reverse +unset key + +set output 'build/gnuplot/acf.svg' + +set xlabel offset 0,1.0 +set xlabel 'Lag' +set title offset 0,-1 +set lmargin 5 +set rmargin 0 +set tmargin 1 +set multiplot layout 2,3 + +round(x) = floor(x+0.5) +filename(axis,timestamp) = sprintf('build/acf/%s/%d', axis, timestamp) +speed(x) = sqrt(x) +positive(x,y) = x>=0 ? y : NaN +positive(x,y) = x<=0 ? y : NaN + +load "build/gnuplot/acf_rmse.gnuplot" + +################################### +# first row +################################### +set yrange [0:2] + +set title sprintf('RMSE_x = %.1f%%', (acf_x_rmse_max*100)) +plot \ +filename('x',acf_x_rmse_max_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' + +set yrange [0:0.25] +set title sprintf('RMSE_y = %.1f%%',(acf_y_rmse_max*100)) +plot \ +filename('y',acf_y_rmse_max_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' + +set yrange [0:0.1] +set title sprintf('RMSE_z = %.1f%%', (acf_z_rmse_max*100)) +plot \ +filename('z',acf_z_rmse_max_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' + +################################### +# second row +################################### +set bmargin 3 +set yrange [0:0.25] + +set title sprintf('RMSE_x = %.1f%%', (acf_x_rmse_min*100)) +plot \ +filename('x',acf_x_rmse_min_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' + +set yrange [0:2] +set title sprintf('RMSE_y = %.1f%%',(acf_y_rmse_min*100)) +plot \ +filename('y',acf_y_rmse_min_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' + +set yrange [0:0.1] +set title sprintf('RMSE_z = %.1f%%', (acf_z_rmse_min*100)) +plot \ +filename('z',acf_z_rmse_min_timestamp) index 0 using (-$1):2 with points pt 6 lc '#404040',\ +'' index 0 using (-$1):3 with lines lw 2 lc '#4040c0',\ +'' index 1 using ($1):2 with points pt 6 lc '#404040',\ +'' index 1 using ($1):3 with lines lw 2 lc '#c04040' diff --git a/main.tex b/main.tex @@ -167,6 +167,7 @@ Usually, autocorrelation is modeled using exponential functions~\cite{box1976tim In this paper we use one-dimensional autocorrelation function written as \begin{equation} \rho\left(t\right) = a_3 \exp\left(-\left(b_3 t\right)^{c_3} \right). + \label{eq-acf-approximation} \end{equation} Here \(a_3>0\), \(b_3>0\) and \(c_3>0\) are parameters of the autocorrelation function that control the shape of the exponent. @@ -338,8 +339,8 @@ and high wind speeds. TODO \includegraphics{build/gnuplot/velocity-dist.eps} \caption{Per-axis wind velocity distributions fitted into Weibull distribution. - Data intervals with the smallest error (the first row), - data intervals with the largest error (the second row). Red line shows estimated + Data intervals with the largest error (the first row), + data intervals with the smallest error (the second row). Red line shows estimated probability density of positive wind speed projections, blue line shows estimated probability density of negative wind speed projections and circles denote observed probability density of wind speed projections. @@ -377,6 +378,20 @@ Larger error for low wind \label{fig-direction-distributions}} \end{figure} +\section{Verification of ACF} + +\begin{figure} + \centering + \includegraphics{build/gnuplot/acf.eps} + \caption{Per-axis wind velocity ACF fitted into~\eqref{eq-acf-approximation}. + Data intervals with the largest error (the first row), + data intervals with the smallest error (the second row). Red line shows estimated + ACF of positive wind speed projections, blue line shows estimated + ACF of negative wind speed projections and circles denote observed + ACF of wind speed projections. + \label{fig-velocity-distributions}} +\end{figure} + \section{Discussion} One disadvantage of three-axis anemometer is that the arm for the \(z\) axis is