java arrays and arrays

0

I have a problem trying to perform this exercise, I already have the part of the finite series and it runs well, although I do not know if the way I did it is fine, the problem is with part one of the time series and I do not understand how to solve it, my idea was to do almost the same as in part two but if I do it that way it will not work because I do not know the divisor since the user gives it. Attached photo of the problem and my code if you can help me I would appreciate it a lot since I have to upload it today.

Description: A time series is a sequence of numerical values obtained from measuring some phenomenon every determined time. Examples of time series are the price of the dollar in every second, the maximum annual temperature of a city, etc. • The moving averages with delay p of a series of time are the sequence of all the averages of p consecutive values of the series. Example: Assuming we have a series {5,2,2,8, -4, -1,2} and a delay p = 3, then the Moving averages are: {(5 + 2 + 2) / 3, (2 + 2 + 8) / 3, (2 + 8-4) / 3, (8-4-1) / 3, (-4, - 1,2) / 3}. • The finite differences of a time series are the sequence of all differences between a value and the previous one. Example: Assuming we have a series {5,2,2,8, -4, -1,2}, then the finite differences of that series are {(2-5), (2-2), (8-2), (-4-8), (-1 + 4), (2 + 1)}

Entry example: Time series = [5,2,2,8, -4, -1,2] Delay p = 3 Example of output: Moving averages of the time series = [3, 4, 2, 1, -1] Finite differences of the time series = [-3, 0, 6, -12, 3, 3] Note: the matrix can be created directly in the main method.

    
asked by Nayra1316 18.08.2018 в 04:04
source

0 answers