| 
									
										
										
										
											2012-11-26 21:06:41 +00:00
										 |  |  | subroutine twkfreq(c3,c4,npts,fsample,a)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-29 13:16:09 -04:00
										 |  |  |   ! Adjust frequency of complex data
 | 
					
						
							|  |  |  |   ! a(1)    Hz
 | 
					
						
							|  |  |  |   ! a(2)    Hz/(0.5*TxT), where TxT = npts/fsample = file duration
 | 
					
						
							|  |  |  |   
 | 
					
						
							| 
									
										
										
										
											2012-11-26 21:06:41 +00:00
										 |  |  |   complex c3(npts)
 | 
					
						
							|  |  |  |   complex c4(npts)
 | 
					
						
							|  |  |  |   complex w,wstep
 | 
					
						
							|  |  |  |   real a(3)
 | 
					
						
							|  |  |  |   data twopi/6.283185307/
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Mix the complex signal
 | 
					
						
							|  |  |  |   w=1.0
 | 
					
						
							| 
									
										
										
										
											2012-11-27 15:38:03 +00:00
										 |  |  |   wstep=1.0
 | 
					
						
							| 
									
										
										
										
											2012-11-26 21:06:41 +00:00
										 |  |  |   x0=0.5*(npts+1)
 | 
					
						
							|  |  |  |   s=2.0/npts
 | 
					
						
							|  |  |  |   do i=1,npts
 | 
					
						
							|  |  |  |      x=s*(i-x0)
 | 
					
						
							| 
									
										
										
										
											2015-03-04 17:07:15 +00:00
										 |  |  |      p2=1.5*x*x - 0.5
 | 
					
						
							| 
									
										
										
										
											2012-11-26 21:06:41 +00:00
										 |  |  | !          p3=2.5*(x**3) - 1.5*x
 | 
					
						
							|  |  |  | !          p4=4.375*(x**4) - 3.75*(x**2) + 0.375
 | 
					
						
							| 
									
										
										
										
											2015-03-04 17:07:15 +00:00
										 |  |  |      dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/fsample)
 | 
					
						
							|  |  |  |      wstep=cmplx(cos(dphi),sin(dphi))
 | 
					
						
							| 
									
										
										
										
											2012-11-26 21:06:41 +00:00
										 |  |  |      w=w*wstep
 | 
					
						
							|  |  |  |      c4(i)=w*c3(i)
 | 
					
						
							|  |  |  |   enddo
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return
 | 
					
						
							|  |  |  | end subroutine twkfreq
 |