mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 13:30:52 -05:00 
			
		
		
		
	Add degrade_snr.f90
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6167 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									cb8113355d
								
							
						
					
					
						commit
						2a0602b19d
					
				
							
								
								
									
										20
									
								
								lib/degrade_snr.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								lib/degrade_snr.f90
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					subroutine degrade_snr(d2,npts,db)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  integer*2 d2(npts)
 | 
				
			||||||
 | 
					  real dat(60*12000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  dat(1:npts)=d2
 | 
				
			||||||
 | 
					  p0=dot_product(dat(1:npts),dat(1:npts))/npts
 | 
				
			||||||
 | 
					  s=sqrt(p0*(10.0**(0.1*db) - 1.0))
 | 
				
			||||||
 | 
					  do i=1,npts
 | 
				
			||||||
 | 
					     d2(i)=nint(dat(i) + s*gran())
 | 
				
			||||||
 | 
					  enddo
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					!  dat(1:npts)=d2
 | 
				
			||||||
 | 
					!  p1=dot_product(dat(1:npts),dat(1:npts))/npts
 | 
				
			||||||
 | 
					!  print*,db,p0,s,10.0*log10(p1/p0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return
 | 
				
			||||||
 | 
					end subroutine degrade_snr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user