I am determining the long term average arrival rate (avg_rate) of network traffic to a system via a time sliding window (TSW) method i.e. the average rate of arrival of traffic is determined in a particular window length of time (win_length). The TSW method I am using is as follows:

A new packet arrives:

total_in_tsw=previous_avg_rate * win_length;
new_total_in_tsw = total_in_tsw + traffic_size;
avg_rate = new_total_in_tsw/(inter_arrival_time + win_length);

It has been demonstrated that if win_length is too small it will only remember history in a short period (and the TSW will be more agile) and will follow the new changes in the traffic rate quickly. However, if win_length is too large it will remember history in a long period and will be more stable so it forgets the short peaks which are very brief and only temporary.

I would like an optimum value of win_length that will provide a stable/agile output. I thought that by using an optimization process such as the steepest descent method I could choose the optimum win_length.

However, I am unsure about creating the objective function for this. Does anyone have ideas or an approach to take on this? I have tried using the fminbnd formula in MATLAB to maximize the avg_rate (which would lead to maximising the throughput in the system) as follows:

x=fminbnd(avg_rate,x1,x2)
where avg_rate is a function that computes the avg_rate for a particular x value and x1 and x2 are upper and lower limits for win_length.

However, I am unsure this is achieving the optimum win_length to provide an optimum avg_rate.

Has anyone ideas/opinions on this?