[Mma] ola's octave examples
Boud Roukema
boud at astro.uni.torun.pl
Tue Apr 1 15:02:07 CEST 2003
# zwiki syntax makes this look horrible. It is easier to see
# in an email archive.
#PIERWSZA FUNKCJA:
function R= A(i, phi)
#funkcja wykonuje obrot elementarny wokol osi 'i' o kat 'phi' w radianach
R= eye(3);
s= sin (phi);
c= cos (phi);
if (i== 1)
R(2,2)= c;
R(3,3)= c;
R(2,3)= s;
R(3,2)= -s;
endif
if (i== 2)
R(1,1)= c;
R(3,3)= c;
R(3,1)= s;
R(1,3)= -s;
endif
if (i== 3)
R(1,1)= c;
R(2,2)= c;
R(1,2)= s;
R(1,2)= -s;
endif
endfunction
# DRUGA FUNKCJA:
function [st, min, sec] = rad2d (rad)
# funkcja zamieniajaca kat w radianach na st, min, sec
str =(180 *rad) / pi;
if str>= 360
str= str-360;
endif
st =fix(str)
x =str-st;
minr =(x * 60);
min =fix(minr)
y =minr - min;
sec =(y * 60)
#sec =round(secr);
endfunction
# TRZECIA FUNKCJA:
function [h,min,sec]= rad2h (rad)
# funkcja zamieniajaca kat w radianach na h, m, s
hr= (rad*12)/pi;
h= fix(hr)
x= hr-h;
mr= (x*60);
m= fix(mr)
y= mr-m;
sec= (y*60)
#s=round(secr);
endfunction
More information about the Mma
mailing list