1 Star 1 Fork 1

JeffreyChan / ReceedingHorizonControlAutonomousVehicle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qtan.m 609 Bytes
一键复制 编辑 原始数据 按行查看 历史
Mohamed 提交于 2016-11-16 09:31 . Add files via upload
function theta=qtan(y1,x1,y2,x2)
theta=atan((y2-y1)/(x2-x1));
%90 degrees
if (x2==x1)&&(y2>y1);
theta = pi/2;
%180 degrees
elseif (x2<x1)&&(y2==y1);
theta = pi;
%270 degrees
elseif (x2==x1)&&(y2<y1);
theta =-pi/2;
%Zero
elseif (x2>x1)&&(y2==y1);
theta =0;
%First Quadrant
elseif (x2>x1)&&(y2>y1);
theta =abs(theta);
%Second Quadrant
elseif (x2<x1)&&(y2>y1);
theta = pi - abs(theta);
%Third Quadrant
elseif (x2<x1)&&(y2<y1);
theta = -pi + abs(theta);
%Fourth Quadrant
elseif (x2>x1)&&(y2<y1);
theta = -abs(theta);
end
end
Matlab
1
https://gitee.com/jeffreychan/ReceedingHorizonControlAutonomousVehicle.git
git@gitee.com:jeffreychan/ReceedingHorizonControlAutonomousVehicle.git
jeffreychan
ReceedingHorizonControlAutonomousVehicle
ReceedingHorizonControlAutonomousVehicle
master

搜索帮助