
windowWidth = 35;
polynomialOrder = 2;

smoothX_cell = sgolayfilt(coord_cell(1,:), polynomialOrder, windowWidth);
smoothY_cell = sgolayfilt(coord_cell(2,:), polynomialOrder, windowWidth);

smoothX_golgi = sgolayfilt(coord_golgi(1,:), polynomialOrder, windowWidth);
smoothY_golgi = sgolayfilt(coord_golgi(2,:), polynomialOrder, windowWidth);

smoothX_nucl = sgolayfilt(coord_nucleus(1,:), polynomialOrder, windowWidth);
smoothY_nucl = sgolayfilt(coord_nucleus(2,:), polynomialOrder, windowWidth);

v1_ang = (atan2(smoothY_cell(1,2:end)-smoothY_cell(1,1:end-1), smoothX_cell(1,2:end)-smoothX_cell(1,1:end-1)))*180/pi;
v2_ang = (atan2(smoothY_golgi(1,2:end)-smoothY_nucl(1,2:end), smoothX_golgi(1,2:end)-smoothX_nucl(1,2:end)))*180/pi;
save('c03_pos14_Angles.mat','v1_ang','v2_ang');

clear all