Commit 57a49f05 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

first good pulse

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 514
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5f771d7e
c this is <siggen.f>
c------------------------------------------------------------------------------
c ($Id: siggen.f,v 1.2 2001-10-24 21:32:49 forbrig Exp $)
c ($Id: siggen.f,v 1.3 2001-10-25 09:41:11 forbrig Exp $)
c
c 24/10/2001 by Thomas Forbriger (IMGF Frankfurt)
c
......@@ -16,7 +16,7 @@ c
character*(*) version
parameter(version='SIGGEN V1.0 SIGnal GENerator')
character*(*) SIGGEN_CVS_ID
parameter(SIGGEN_CVS_ID='$Id: siggen.f,v 1.2 2001-10-24 21:32:49 forbrig Exp $')
parameter(SIGGEN_CVS_ID='$Id: siggen.f,v 1.3 2001-10-25 09:41:11 forbrig Exp $')
c
c parameters
integer nsig,ncyc
......@@ -48,7 +48,7 @@ c here are the keys to our commandline options
data optid/2h-D, 2h-v, 2h-o, 2h-f, 2h-T, 2h-a, 2h-d,
& 3h-Ta,3h-Te,2h-n,3h-Td,3h-Tm,3h-f1,3h-f2,2h-e/
data opthasarg/3*.FALSE.,12*.TRUE./
data optarg/3*1h-,3h20.,3*2h1.,2h0.,3h20.,1h5,5h1.e20,3h30.,
data optarg/3*1h-,3h20.,2*2h1.,4h.001,2h0.,3h.02,1h5,5h1.e20,4h.005,
& 2*3h20.,1h1/
c
c------------------------------------------------------------------------------
......@@ -79,20 +79,20 @@ c
print *,'-T T set time parameter to ''T''s'
print *,' this is the length of the signal'
print *,' (default: ',optarg(5)(1:3),')'
print *,'-d d set time parameter to ''d''ms'
print *,'-d d set time parameter to ''d''s'
print *,' this is the sampling interval'
print *,' (default: ',optarg(7)(1:3),')'
print *,'-a a set amplitude parameter to ''a'' '
print *,' this is the signal amplitude'
print *,' (default: ',optarg(6)(1:3),')'
print *,' '
print *,'-Ta Ta set time parameter Ta to ''Ta''ms'
print *,'-Ta Ta set time parameter Ta to ''Ta''s'
print *,' (default: ',optarg(8)(1:3),')'
print *,'-Te Te set time parameter Te to ''Te''ms'
print *,'-Te Te set time parameter Te to ''Te''s'
print *,' (default: ',optarg(9)(1:3),')'
print *,'-Td Td set time parameter Td to ''Td''ms'
print *,'-Td Td set time parameter Td to ''Td''s'
print *,' (default: ',optarg(11)(1:3),')'
print *,'-Tm Tm set time parameter Tm to ''Tm''ms'
print *,'-Tm Tm set time parameter Tm to ''Tm''s'
print *,' (default: ',optarg(12)(1:3),')'
print *,'-n n set cycle parameter n to ''n'' cycles'
print *,' (default: ',optarg(10)(1:3),')'
......@@ -182,39 +182,39 @@ c
print *,'parameters:'
print 50,'amplitude','a',a,' '
print 50,'frequency','f',f,'Hz'
print 50,'sampling interval','d',d,'ms'
print 50,'sampling interval','d',d,'s'
print 50,'time series lentgh','T',t,'s'
endif
nsamples=int(1.e3*t/d)
nsamples=int(t/d)
if (verbose) then
print *,'derived parameters:'
print 52,'number of samples',nsamples,' '
endif
do i=1,nsamples
data(i)=a*sin(2*pi*(i-1)*d*1.e-3*f)
data(i)=a*sin(2*pi*(i-1)*d*f)
enddo
elseif (nsig.eq.2) then
if (verbose) then
print *,'Mueller-Bruestle function'
print *,'parameters:'
print 50,'amplitude','a',a,' '
print 50,'sampling interval','d',d,'ms'
print 50,'sampling interval','d',d,'s'
print 50,'time series lentgh','T',t,'s'
print 50,'onset of wavelet','Ta',ta,'ms'
print 50,'end of wavelet','Te',te,'ms'
print 50,'onset of wavelet','Ta',ta,'s'
print 50,'end of wavelet','Te',te,'s'
endif
nsamples=int(1.e3*t/d)
nsamples=int(t/d)
if (verbose) then
print *,'derived parameters:'
print 52,'number of samples',nsamples,' '
endif
do i=1,nsamples
ti=d*1.e-3*(i-1)
if (ti.lt.(1.e-3*ta)) then
ti=d*(i-1)
if (ti.lt.ta) then
data(i)=0.
elseif(ti.le.(1.e-3*te)) then
data(i)=a*(-0.75*cos(pi*(ti-1.e-3*ta)/(1.e-3*(te-ta)))+
& 0.25*cos(pi*(ti-1.e-3*ta)/(1.e-3*(te-ta)))**3)
elseif(ti.le.te) then
data(i)=a*(-0.75*cos(pi*(ti-ta)/(te-ta))+
& 0.25*cos(pi*(ti-ta)/(te-ta))**3)
else
data(i)=a
endif
......@@ -232,40 +232,68 @@ c
print *,'modulated and damped sine wave'
print *,'parameters:'
print 50,'amplitude','a',a,' '
print 50,'sampling interval','d',d,'ms'
print 50,'sampling interval','d',d,'s'
print 50,'time series lentgh','T',t,'s'
print 50,'onset of wavelet','Ta',ta,'ms'
print 50,'damping time constant','Td',td,'ms'
print 50,'onset of wavelet','Ta',ta,'s'
print 50,'damping time constant','Td',td,'s'
print 51,'number of cycles','n',ncyc,' '
print 50,'frequency variation exponent','e',expo,' '
print 50,'initial frequency','f1',f1,'Hz'
print 50,'final frequency','f2',f2,'Hz'
endif
nsamples=int(1.e3*t/d)
c b=((2*f2-f1)**2-f1**2)/(4*ncyc)
c tend=1.e3*(1.e-3*ta-f1/(2.*b)+sqrt(f1**2+4.*b*float(ncyc))/(2.*b))
tend=float(ncyc*(expo+1))/(f2+float(expo)*f1)
b=((f2-f1)/float(expo+1))*myexpo(tend,-expo)
tend=ta+1.e3*tend
nsamples=int(t/d)
tend=ta+2.*ncyc/(f1+f2)
b=(f2**2-f1**2)/(4.*ncyc)
if (verbose) then
print *,'derived parameters:'
print 52,'number of samples',nsamples,' '
print 53,'end of signal',tend,'ms'
print 53,'end of signal',tend,'s'
print 53,'frequency modulation slope',b,'Hz/s'
print 53,'initial frequency',f1,'Hz'
print 53,'final frequency',
& f1+(expo+1)*b*myexpo(dble(1.e-3*(tend-ta)),expo),'Hz'
print 53,'total cycles',
& (f1+b*myexpo(dble(1.e-3*(tend-ta)),expo))*1.e-3*(tend-ta),' '
print 53,'final frequency',f1+2.*b*(tend-ta),'Hz'
print 53,'total cycles',(f1+b*(tend-ta))*(tend-ta),' '
endif
do i=1,nsamples
ti=d*1.e-3*float(i-1)
if (ti.lt.(1.e-3*ta)) then
ti=d*float(i-1)
if (ti.lt.ta) then
data(i)=0.
elseif(ti.le.(1.e-3*tend)) then
data(i)=a*(sin(2*pi*(f1+b*myexpo(dble(ti-1.e-3*Ta),expo))*(ti-1.e-3*Ta))*
& exp(-1.e3*(ti-1.e-3*Ta)/Td))
data(i)=f1+(expo+1.)*b*myexpo(dble(ti-1.e-3*Ta),expo)
elseif(ti.le.tend) then
data(i)=a*(sin(2*pi*(f1+b*(ti-ta))*(ti-ta))*
& exp(ti-Ta/Td))
else
data(i)=0.
endif
enddo
elseif (nsig.eq.6) then
if (verbose) then
print *,'asymmetric sine pulse'
print *,'parameters:'
print 50,'amplitude','a',a,' '
print 50,'sampling interval','d',d,'s'
print 50,'time series lentgh','T',t,'s'
print 50,'onset of wavelet','Ta',ta,'s'
print 50,'zero of wavelet','Tm',tm,'s'
print 50,'end of wavelet','Te',te,'s'
print 50,'damping time constant','Td',td,'s'
endif
nsamples=int(t/d)
b=log(0.5)/log(1.-(Tm-ta)/(te-ta))
if (verbose) then
print *,'derived parameters:'
print 52,'number of samples',nsamples,' '
print 53,'frequency modulation exponent',b,' '
print 53,'phase at ta',(1.-myexpo(dble(1.-(ta-ta)/(te-ta)),b)),'2pi'
print 53,'phase at tm',(1.-myexpo(dble(1.-(tm-ta)/(te-ta)),b)),'2pi'
print 53,'phase at te',(1.-myexpo(dble(1.-(te-ta)/(te-ta)),b)),'2pi'
print 53,'frequency at te',
& b/(te-ta)*myexpo(dble(1.-(te-ta)/(te-ta)),(b-1.)),'Hz'
endif
do i=1,nsamples
ti=d*float(i-1)
if (ti.lt.ta) then
data(i)=0.
elseif(ti.le.te) then
data(i)=a*(sin(2*pi*(1.-myexpo(dble(1.-(ti-ta)/(te-ta)),b)))*
& exp(-(ti-Ta)/Td))
else
data(i)=0.
endif
......@@ -279,7 +307,7 @@ c tend=1.e3*(1.e-3*ta-f1/(2.*b)+sqrt(f1**2+4.*b*float(ncyc))/(2.*b))
if (i.ne.0) stop 'ERROR: deleting output file'
endif
call sffu_simpleopen(lu,filename)
call sffu_simplewrite(lu, .true., data, nsamples, 1.e-3*d, 0.)
call sffu_simplewrite(lu, .true., data, nsamples, sngl(d), 0.)
stop
50 format(3x,a30,1x,a3,1x,f10.3,a4)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment