EunGyeongKim

필터링 (kalman, Butterworth, loss-pass, high-pass, Gaussian, 3 point moving average filter) 본문

기타 컴퓨터/신호처리

필터링 (kalman, Butterworth, loss-pass, high-pass, Gaussian, 3 point moving average filter)

EunGyeongKim 2023. 7. 25. 06:01

필터링

  • 원 데이터 → 노이즈 제거 및 신호 분석을 위해 필터링 사용

합성곱을 이용한 필터

  • 가우시안 필터링 (Gaussian filterinf)
    • 가우시안을 이용한 필터링
    • 가중치를 [0.25, 0.5, 0.25]으로 설정하여 이용.
  • 3점이동평균 필터 (3 point moving average filter)
    • 시계열 데이터에서 사용되는 필터링 방법
    • 인접한 3개의 데이터 포인트를 이용하여 이동 평균값을 구하는 방법
    • 작은 시간 간격으로 일어나는 빠른 변화를 캡처하지 못함

# 필요한 컬럼 선택하기
column_name = 'column1' # 분석하고자 하는 컬럼 이름
data = df[column_name].values # 선택한 컬럼의 값만 NumPy 배열로 가져오기

# 필터링할 윈도우 사이즈와 가중치 설정
window_size = 3
# weights = [0.25, 0.5, 0.25] # 가우시안 필터링
weights = [1, 2, 1] # 3점 이동평균필터
# 가우시안 필터링을 사용하려면 weights = [0.25, 0.5, 0.25]로 설정

# 합성곱 연산 수행
filtered_data = convolve(data, weights, mode='same') / sum(weights)

  • 버터워스 필터
    • high pass
      • 저주파 제거 (cut off : 400)
        • 신호의 노이즈 제거를 위해 사용
        • 큰 주기를 제거하는것이라 노이즈가 그대로 남아있음
        • 어디가 시작~ 끝인지 알기 힘듬
        • 위아래로 흔들리던 데이터가 0 근처로 필터링? 됨

    • low-pass
      • 고주파 제거 (cut off : 100)
        • 신호의 평활화를 위해 사용
        <원데이터>

        cut-off 100 low-pass, cutoff가 너무 작아서 평활화가 제대로 안됨…ㅎ 400은 되야 할듯
        • 자잘하게 튀는 노이즈가 제거됨
        • 시작과 끝을 구분할수 있게 됨
        • 10kph인경우 위아래로 많이 흔들림
          • 값의 range가 90kph 보다 좁기 때문에 도로를 달릴때 생기는 주파수가 도드라지는것 같음.
        • 사용한 논문 예시
          • 2021_Nan Xu_Tire slip angle estimation based on the intelligent tire
            • Filtering : the sampling frequency of the collected acceleration signal is 10 kHz, which is processed by a 5 order Butterworth low-pass filter with a tuned cut-off frequency(i.e. 400 Hz) to obtain the contact patch. However, the filtered data in higher frequency will be used for road condition dentification in future studies.
          • 2020_Nan Xu__Tire Force Estimation in Intelligent Tires Using
            • 걍 In this paper, the acceleration signal is filtered with 400Hz of cut-off frequency. 라고만 나왔음
          • 2014_Mika Matilainen_Tyre contact length on dry and wet road surface smeasured by three-axial accelerometer
            • the data were lowpass filtered (zero-phase digital filtering, cut-off 1600 Hz).
          • 2014_Finland_Alto University_Three 3 axis accelerometers fixed inside the tyre for studying contact patch deformations in wet conditions
            • 8th-order zero-phase Butterworth filter
    • high, low 둘다 적용
      # 필터링 파라미터
      fs = 1000  # 샘플링 주파수
      highcut = 100  # 고주파 대역 500추천
      lowcut = 5 # 저주파 컷오프 주파수 (Hz)
      nyquist_rate = fs / 2  # 나이퀴스트 주파수
      order = 6  # 필터 차수
      
      def butter_bandpass(lowcut, highcut, fs, order=2):
          nyq = 0.5 * fs
          low = lowcut / nyq
          high = highcut / nyq
          b, a = butter(order, [low, high], btype='band')
          return b, a
      
      b, a = butter_bandpass(lowcut, highcut, fs, order=2)
      
      # 필터링을 적용한다
      filtered_data = lfilter(b, a, data)
      • 저주파, 고주파 제거(cut off : 5, 100)
      • 위아래로 흔들리는 저주파 주기 및 노이즈 제거!

  • 칼만필터 (kalman filtering)
    • 이전 값 기록을 분석 후 다음값 추정하는 방식으로 필터링함
    • 머신러닝에서 가중치 업데이트 하는 방법이랑 비슷함.

    • 사용 논문 예시
      • 2019_Kanwar Bharat Singh_Accelerometer Based Method for Tire Load and Slip Angle Estimation
  • Gaussian smoothing filter
    • 사용 논문 예시
      • 2019_Bing Zhu_Tire-Pressure Identification Using Intelligent Tire with Three-Axis Accelerometer
  • band-pass filter
    • 범위 잡아서 추출해내기 (500~1500사이의 주파수만 살리기)
    • 2013_Singh_An Intelligent Tire Based Tire-Road Friction Estimation Technique and Adaptive Wheel Slip Controller for Antilock Brake System

'기타 컴퓨터 > 신호처리' 카테고리의 다른 글

나이퀴스트 이론**_*(Nyquist frequency)_***  (0) 2023.07.27
kalman fileter  (0) 2023.07.26
Comments