|
Dear,
I'm working on human gait analysis, and I have to work with motion curves in MatLab. And I have to say that I'm new in MatLab.
My problem is related to defining normal vectors of two 2d curve, and plot that vectors in evry point on the curves. After that, I have to define angle between corespondent normal vectors. I'm creating curve from set of x and y points (e.i. from MS Excel file).
I tried to define normal vectors and angles between them , but I'm not sure that I'm doing the right thing.
%reading.xls files
a = xlsread('Marker femur-koleno_IP_24.05.P.xls');
b = xlsread('Marker tibia-koleno_IP_24.05.P.xls');
%definingu x & y coordinates in file a
x1 = a(:,1);
y1 = a(:,2);
%definingu x & y coordinates in file b
x2 = b(:,1);
y2 = b(:,2);
%Number of rows
i1=219;
%Unit normal vector
n=[1 1]
%Curves plotting
plot(x1,y1,'r',x2,y2,'b')
hold on
%Defining points (r0 & r0tt) on the curves in which I have to plot the normal vector of % curve
% k & p defining points and normal vectors on them
%ang defining angle between normal vectors of curves in corespondent points
for i=1:i1
r0=[x1(i) y1(i)];
r0tt=[x2(i) y2(i)];
k=quiver(r0(1), r0(2), n(1), n(2));
p=quiver(r0tt(1), r0tt(2), n(1), n(2));
ang(i) = (180/pi)*(atan2(abs(r0(1)*n(2)-n(1)*r0tt(2)),r0(1)*r0tt(1)+n(1)*n(2)));
end
hold off
I hope so that you'll help me because I have no more ideas.
Best regards,
Suzana
|