Questions tagged [moving-average]

A calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

Moving average is a calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

1034 questions
0
votes
1 answer

Calculating moving averages between date x and date y

I am trying to calculate a moving average in my sql script. It is a moving average because users supply a date range. For example, Select a.hospital, avg(a.count) as 'Averages', a.date from Records as a group by a.hospital, a.date having a.date >=…
JGF
  • 19
  • 3
0
votes
3 answers

How to set an initial moving average value in Java?

I want to actively calculate the moving average of stock data using the formula below: public class Average { private static double usdJpy; private int counter = 1; private double movingAverageUsdJpy_ = 100.5; public void…
Emir54
  • 21
  • 4
0
votes
1 answer

MySQL : How to average the one column based on first 5 records of every each date of the record?

Example : Source columns are fld_daily_val, fld_date Table Name : tbl_five_days_avg id fld_daily_val fld_date 1 3.3658974569 2016-02-01 2 2.215478659 …
Logu
  • 11
  • 4
0
votes
1 answer

fread and fwrite parameters in C

I am trying to adapt a matlab program to C, my problem is in the fwrite and fread function. On matlab I have: fid = fopen ('sweep_100_3400.pcm','rb'); s = fread (fid, 'int16'); My doubt is, in C there are two more parameters in fread and fwrite…
Mutante
  • 278
  • 5
  • 18
0
votes
1 answer

Movin Average conveting matlab script to C program

I am trying to do a Moving Average code in C, I've already done this in matlab and works. I've converted the matlab script manually to C language, but I am having some problems. #include #include int main() { int m = 16; …
Mutante
  • 278
  • 5
  • 18
0
votes
1 answer

Does averaging/filtering an autocorrelation input signal wrongfully change the output?

I'm investigating sensor measurements of NO2 in the atmosphere over the course of several days. My first interest is to find periodicity of the data to which end I'm using autocorrelation. My problem is that the praxis seems to be to use moving…
0
votes
1 answer

Python add moving average to data frame

I have a fairly large data frame in python and I am trying to add a new column for moving average. I can add the moving average for the table as a whole, the problem is I need to do multiple moving averages based off of the values in column b. For…
0
votes
0 answers

VHDL Moving average: simulation & synthesis result differ (Vivado)

For my project I need to reduce a noise of an ADC output and implemented a simple moving average filter in VHDL. Although it works in simulation (see the picture): it has some strange behavior if I display it on the chipscope when the system is…
selyunin
  • 1,530
  • 2
  • 23
  • 30
0
votes
0 answers

Moving window to grab hourly reading, netcdf file, python

moving window to grab hourly reading, netcdf file, python what am i doing wrong here i want to grab 4 files then move to the next 4 files? what i want to do i grab the first 4 then move to the next 4 as below.. im trying to match it with the…
A.A
  • 13
  • 6
0
votes
1 answer

Moving Average Function Issue

I have two vectors. Every day I want to add a row to make the dataset one row larger: day1 <- c(0,0,8,10,4,5,3,5,6,10,7,11,9,7,10,13,8,7,5,4) day2 <- c(0,0,8,10,4,5,3,5,6,10,7,11,9,7,10,13,8,7,5,4,0) I have two functions that act as a cumulative…
greeny
  • 425
  • 1
  • 6
  • 20
0
votes
1 answer

Calculated Item in OBIEE - Moving Average

I have consulted this question - OBIEE Moving Average (Mavg) for 4 weeks on Pivot Table - in order to understand how to do a moving average in OBIEE. However, I am having trouble calculating that item in a pivot table. In the pivot table view I…
a.powell
  • 1,572
  • 4
  • 28
  • 39
0
votes
1 answer

How does pandas rolling_mean() work?

I need to use a moving average to smooth my data, so I have written a function using convolution. But the results are a left shift compared to my raw data. So I have used the built-in rolling_mean() from pandas and it works just fine. The problem is…
wiedzminYo
  • 531
  • 4
  • 11
  • 24
0
votes
3 answers

Compute mean value over a sliding window in MATLAB

I have a time series data or considering a real valued data of length N. I want to create sub-blocks of length k, which is the window length. The value of k can be arbitrarily chosen. This creates problem since the window size is the same across the…
Srishti M
  • 533
  • 4
  • 21
0
votes
1 answer

Using vectorization to compute moving average in Matlab

I wrote a script to compute simple moving average of a vector using for-loop: X=rand(1000,1); Y=nan(size(A)); for i=100:length(A); Y(i)=mean(X(i-99:i)); end Could I use any vectorization method to avoid the loop? Thanks.
GK.Ai
  • 23
  • 5
0
votes
0 answers

R - Calculate Rolling Statistics Over a Variable Within a Factor

I am trying to calculate mean of n values from one vector based on spread of values around x in another vector – within each categorical factor. I have attached a data frame with sample data and expected results. Basically I am looking at fish catch…
Emma
  • 1
  • 2