You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					11 lines
				
				214 B
			
		
		
			
		
	
	
					11 lines
				
				214 B
			| 
								 
											6 years ago
										 
									 | 
							
								class FirstOrderFilter():
							 | 
						||
| 
								 | 
							
								  # first order filter
							 | 
						||
| 
								 | 
							
								  def __init__(self, x0, ts, dt):
							 | 
						||
| 
								 | 
							
								    self.k = (dt / ts) / (1. + dt / ts)
							 | 
						||
| 
								 | 
							
								    self.x = x0
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  def update(self, x):
							 | 
						||
| 
								 | 
							
								    self.x = (1. - self.k) * self.x + self.k * x
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 |