【问题标题】:Draw angles lines over circle and get the intersecting points在圆上绘制角度线并获得相交点
【发布时间】:2018-07-03 05:40:53
【问题描述】:

我希望在圆上绘制角度线(我在脚本中更改了角度)。我得到的情节线是 0 角,为什么脚本没有全部显示出来,我该如何解决? 另外,如何计算交点?

脚本:

clc;
clear;
close all;

r=1000;

% based on : https://stackoverflow.com/questions/29194004/how-to-plot-a-circle-in-matlab
nCircle = 1000;

t = linspace(0,2*pi,nCircle);

xCircle = 0+ r*sin(t);  
yCircle = 0+ r*cos(t);  

line(xCircle,yCircle );

axis equal;
hold on;

nAngles = 45;
inceasedNumber = 360/nAngles;
lineLength = r+50;

for angle = 0:359:inceasedNumber
    xLine(1) = 0;
    yLine(1) = 0;
    xLine(2) = xLine(1) + lineLength * cosd(angle);
    yLine(2) = yLine(1) + lineLength * sind(angle);
    plot(xLine, yLine);
end

【问题讨论】:

    标签: matlab plot geometry intersection curve


    【解决方案1】:

    我认为您的 for 循环的定义有误。步长必须出现在迭代开始和结束之间的中间:

    for angle = 0:inceasedNumber:359
    

    此外,MATLAB 使用弧度来指定角度,因此 360° 等于 2pi,您必须相应地更改输入。

    对于线和圆的交点,我会在实施前考虑几何;)

    【讨论】:

    • 谢谢。我只是用圆圈作为近距离物体的例子。我对相交线的坐标感兴趣。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多