MATLAB: Converting Python to Matlab

python

Spent a few hours on trying to figure out why the outputs are different, no luck. Python and Matlab are in a txt file along with their outputs.
Suggestions on what I should be looking at to resolve the issue?

Best Answer

Small typo in MATLAB code in nu2
nu2 = atan2(-(xc(k)-xp(n))*sin(theta(k))+(yc(k)-yp(n))*cos(theta(n))+(xp(n+1)-xp(n))*sin(theta(n))-(yp(n+1)-yp(n))*cos(theta(n)),(xc(k)-xp(n))*cos(theta(n))+(yc(k)-yp(n))*sin(theta(n))-(xp(n+1)-xp(n))*...
cos(theta(n))-(yp(n+1)-yp(n))*sin(theta(n))); % fixed!