Hugo Henris
Programmer
Hello everyone,
I'm a student in Belgium in Mathematics and for my master's thesis, I've to create some Lissajous curves
One of my teachers helps me and send me this code in Fortran! But I don't understand anything, my lesson in Fortran was in a new fortran version and this code is written in an old one.
I have to compile this code with "gfortran Hugo-lissajou.f -o test" in the terminal and generate some figures. But I receive some illegible files like "fort.32" that I can't plot on my laptop
program lissajou
implicit real*8(a-h,m-z)
pi=4.d0*datan(1.d0)
twopi=2.d0*pi
x0=1.d0
y0=1.d0
write(*,*) 'itype, p, q, N, phi0, aphix (*pi = phix) ?'
read(*,*) itype,ip,iq,IN,phi0,aphix
p=ip
q=iq
GN=IN
phix=pi*aphix
phiy=(q*phix-pi*phi0)/p
write(*,*) (q*phix-p*phiy)/pi,phi0
do 800 i=1,IN
IPAS=200
GPAS=IPAS
per=1.0d0
pas = per/GPAS
write(*,*) IPAS,GPAS,Per,pas
do 200 k=0,IPAS
tau=k*pas
if(itype.eq.1) then
t=tau+I/GN
x=x0*dsin(twopi*p*t+phix)
y=y0*dsin(twopi*q*t+phiy)
else
t1=p*tau+I/GN
x=x0*dsin(twopi*t1+phix)
t2=q*tau+I/GN
y=y0*dsin(twopi*t2+phiy)
endif
write(30+i,98) tau,x,y
if(k.eq.0) write(30,98) tau,x,y
98 format(1x,3(f13.9,2x))
200 continue
800 continue
stop
end
Thank you very much and sorry for my English level
Hugo
I'm a student in Belgium in Mathematics and for my master's thesis, I've to create some Lissajous curves
One of my teachers helps me and send me this code in Fortran! But I don't understand anything, my lesson in Fortran was in a new fortran version and this code is written in an old one.
I have to compile this code with "gfortran Hugo-lissajou.f -o test" in the terminal and generate some figures. But I receive some illegible files like "fort.32" that I can't plot on my laptop
program lissajou
implicit real*8(a-h,m-z)
pi=4.d0*datan(1.d0)
twopi=2.d0*pi
x0=1.d0
y0=1.d0
write(*,*) 'itype, p, q, N, phi0, aphix (*pi = phix) ?'
read(*,*) itype,ip,iq,IN,phi0,aphix
p=ip
q=iq
GN=IN
phix=pi*aphix
phiy=(q*phix-pi*phi0)/p
write(*,*) (q*phix-p*phiy)/pi,phi0
do 800 i=1,IN
IPAS=200
GPAS=IPAS
per=1.0d0
pas = per/GPAS
write(*,*) IPAS,GPAS,Per,pas
do 200 k=0,IPAS
tau=k*pas
if(itype.eq.1) then
t=tau+I/GN
x=x0*dsin(twopi*p*t+phix)
y=y0*dsin(twopi*q*t+phiy)
else
t1=p*tau+I/GN
x=x0*dsin(twopi*t1+phix)
t2=q*tau+I/GN
y=y0*dsin(twopi*t2+phiy)
endif
write(30+i,98) tau,x,y
if(k.eq.0) write(30,98) tau,x,y
98 format(1x,3(f13.9,2x))
200 continue
800 continue
stop
end
Thank you very much and sorry for my English level
Hugo