Choosing low-pass filter parameters I have position of objects from recording sampled at 30 fps. I wish to remove high frequencies from position with the help of low-pass filter.

I am confused as to how to choose the filter parameters in this respect->

[b,a] = butter(n,Wn) 


that is , n and Wn in this case.

Data:

K&gt;&gt; [xcor_i,ycor_i ]

ans =

 -101.7000  -77.4040
 -102.4200  -77.4040
 -103.6600  -77.4040
 -103.9300  -76.6720
 -103.9900  -76.5130
 -104.0000  -76.4780
 -105.0800  -76.4710
 -106.0400  -77.5660
 -106.2500  -77.8050
 -106.2900  -77.8570
 -106.3000  -77.8680
 -106.3000  -77.8710
 -107.7500  -78.9680
 -108.0600  -79.2070
 -108.1200  -79.2590
 -109.9500  -80.3680
 -111.4200  -80.6090
 -112.8200  -81.7590
 -113.8500  -82.3750
 -115.1500  -83.2410
 -116.1500  -83.4290
 -116.3700  -83.8360
 -117.5000  -84.2910
 -117.7400  -84.3890
 -118.8800  -84.7770
 -119.8400  -85.2270
 -121.1400  -85.3250
 -123.2200  -84.9800
 -125.4700  -85.2710
 -127.0400  -85.7000
 -128.8200  -85.7930
 -130.6500  -85.8130
 -132.4900  -85.8180
 -134.3300  -86.5500
 -136.1700  -87.0760
 -137.6500  -86.0920
 -138.6900  -86.9760
 -140.3600  -87.9000
 -142.1600  -88.4660
 -144.7200  -89.3210


Code:

[b,a] = butter(6,0.6,'low');
dataOut_x = filter(b,a,xcor_i);
dataOut_y = filter(b,a,ycor_i);

K&gt;&gt; plot(xcor_i,ycor_i,'Linewidth',2 );
K&gt;&gt; hold on
K&gt;&gt; plot(dataOut_x,dataOut_y,'Linewidth',2)




Clearly, my parameters aren't correct. 

Moe info:
I have tried a simple moving average, doesn't work that well. I am recording people from an overheard camera. I have tracks of each's head using some software. I want to periodicity from tracks due to head wobbling. 

Link to same question on stackoverflow: 
https://stackoverflow.com/questions/34616131/choosing-low-pass-filter-parameters?noredirect=1#comment56979276_34616131
The main issue is that the filters start with an initial position of (0,0). Then when you filter your actual data, the filter output has to ramp up to the actual position. In doing so, you can also observe some overshoot since your filter has a very short time response.

It would help if you were to start with a better estimate of the initial position by using for example the first position with:

dataOut_x = xcor_i(1)+filter(b,a,xcor_i-xcor_i(1));
dataOut_y = ycor_i(1)+filter(b,a,ycor_i-ycor_i(1));


The resulting plot would then look like: