I have a data set of around 200000 lines. The data has 2 columns say x and y. I am giving a simplified example of the same below. X = [1, 5, 7, 12, 18, 25] Y= [20, 25, 32, 28, 27, 31]
This means for x values 1 to 4 y value is 20. For x =5 and 6 y = 25. For x=7 to 11 y =25 like that. Now I want to calcate average of subsets of x with 5 numbers. For example average of y of x values 1:5, then 6:10, 11:15 etc. For example, I expect average of 6:10 subset as [25*1(y value of x=6) + 32*4(y value of 7,8,9,10)] รท 5. What is the simplest way for doing this in matlab. I am a beginner in matlab programming.
Best Answer