Matlabs椭圆小时计算
我做日晷模拟器,画椭圆,然后在椭圆上画小时。我们的每一项工作都由以下方面规定:Matlabs椭圆小时计算,matlab,geolocation,geocoding,ellipse,hour,Matlab,Geolocation,Geocoding,Ellipse,Hour,我做日晷模拟器,画椭圆,然后在椭圆上画小时。我们的每一项工作都由以下方面规定: 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) %inpu
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
最后我得到了那张照片:
但它应该是这样的:
椭圆是正确的,我为其他纬度绘制了我的版本
也许有人能帮我
对不起,我说的是英语:
编辑
我修复它-只需将度转换为弧度
编辑2
< >我改变源代码FY/
因为你解决了你的问题,考虑你自己的答案并接受它,或者把你的问题全部删除。
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