geolocation - Matlabs ellipse hours calc -
i make sundial simulator , draw ellipse , have draw hours on ellipse. every our specified by:
x = * sin(t); y = b * cos(t);
where:
a- length of longer semi-axis b- length of smaller semi-axis t- hour in degrees ( 1 hour == 15 degrees)
i wrote function in 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; i=1:1:24 hx(i)= ra * sin(step); hy(i)= rb * cos(step); step = step+hourangle; end end
finally pic: my ellipse , hours points
but should looks like: correct hour place's
ellipse correct ( draw version other latitude ).
maybe me ?
sorry english :)
edit
i repair - convert degrees radians.
edit2
i change source code fyi
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; i=1:1:24 hx(i)= ra * sin(step); hy(i)= rb * cos(step); step = step+hourangle; end end
Comments
Post a Comment