"Henry" wrote in message <jne4m5$hrr$1@newscl01ah.mathworks.com>...
> I need to write script for a 2D model of two points falling in different positions but at the same rate which have been digitised into excel format where each entry relates to time, these points at an unknown point in time start to turn around one and other as if an object falling hits an inclined plate.
>
> This these points are used to measure the rotational acceleration. I become unstuck in how to write the script in a way that can identify the point of which rotation begins and how to write in the script what the rotational acceleration of the two points is once it has started to rotate.
>
> Any help will be much appreciated
        
Your description is rather hard to follow. You speak of "an object falling hits an inclined plate" (which would seemingly imply an infinite acceleration impulse,) or of an "excel format", which I have no knowledge of.
For matlab purposes suppose we assume that you have five column vectors, x1, y1, x2, y2, and t, all the same length, representing the x and y coordinates of the first and second points in some xy plane at the corresponding times in t. One of the things you will presumably need to determine is the angle with respect to the xaxis made by a 2D vector extending from point 1 to point 2. For this purpose you can use matlab's 'atan2' function.
ang = atan2(y2y1,x2x1);
where 'ang' will then be a vector which gives this angle in radians for each of the times in t. This angle will range from pi to +pi. In order to prevent sudden jumps in 'ang' if the angle crosses pi or pi you can apply the 'unwrap' function to 'ang'.
ang = unwrap(ang);
(This assumes of course that no two successive angles differ by as much as pi radians.)
As for "rotational acceleration", by which I assume you mean angular acceleration, if the above x, y, and t vectors are very accurate, you can use a second difference approximation for the second derivative of 'ang' with respect to t. Even if the values in t are not uniformly spaced this could nevertheless be done as follows
ange = [ang(3);ang;ang(end2)];
te = [t(3);t;t(end2)];
acc = 2*diff(diff(ange)./diff(te))./(te(3:end)te(1:end2));
where 'acc' is the resulting second difference approximation to angular acceleration.
If the points' positions is not given by the x, y, and t vectors to sufficient accuracy, then some kind of filtered version of the second derivative should be used which involves averages over more than three successive time points. I would suggest you do some searching for this on the matlab File Exchange.
Roger Stafford
