【问题标题】:Matlabs ellipse hours calcMatlab椭圆小时计算
【发布时间】:2015-04-26 00:09:02
【问题描述】:

我制作日晷模拟器,然后画椭圆,然后我必须在这个椭圆上画小时。每个我们的指定:

x = a * sin(t);
y = b * cos(t);

地点:

a- length of longer semi-axis
b- length of smaller semi-axis
t- hour in degrees ( 1 hour == 15 degrees)

我在 Matlab 中写了这个函数:

function [hx,hy] = calcHourCoords(ra,rb)
    %input:
    %ra, rb length of semi-axis in ellipse
    %output:
    %hx, hy coords of hour's plot
    hourAngle = 15*180/pi;
    step = 0;
    for i=1:1:24
       hx(i)= ra * sin(step);
       hy(i)= rb * cos(step);
       step = step+hourAngle;
    end
end

最后我得到了这张照片: My ellipse and hours points

但是应该看起来像: Correct hour place's

椭圆是正确的(我为其他纬度绘制了我的版本)。

也许有人可以帮助我?

对不起我的英语:)

编辑

我修复它 - 只需将度数转换为弧度。

EDIT2

我更改源代码仅供参考

【问题讨论】:

  • 既然你解决了你的问题,考虑把你自己的答案放进去并接受它,或者把你的问题一并删除。

标签: matlab geolocation geocoding ellipse hour


【解决方案1】:
function [hx,hy] = calcHourCoords(ra,rb)
    %input:
    %ra, rb length of semi-axis in ellipse 
    %output:
    %hx, hy coords of hour's plot
    hourAngle = 15*pi/180;
    step = 0;
       for i=1:1:24
           hx(i)= ra * sin(step);
           hy(i)= rb * cos(step);
           step = step+hourAngle;
       end
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-07
    • 2014-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多