Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Low Pass Filter by Octave

Though I had an example of low pass filter coded in Octave and I'm sure it works, I can't understand. How dose this work? and How can I know cut-off frequency of this filter?

The original_data is a column of water quality data I obtained with 1Hz.

l = rows(original_data);
a = fft(original_data);
for i = (1:l);
 if i >9
  a(i) = 0;
 endif
endfor
b = fft(original_data);
for i = (1:l)
 if i > 1
  b(i) = 0;
 endif
endfor
c = real(ifft(a));
c(1);
d = real(ifft(a))*2-c(1);

If you have any idea, please help me.

like image 552
user3021107 Avatar asked Dec 02 '25 12:12

user3021107


1 Answers

I agree with the comment, there are plenty of functions to allow you to design a low-pass filter correctly (see http://octave.sourceforge.net/signal/overview.html, in particular the IIR and FIR filter design sections). Once you have designed your filter you can apply it using the function filter or filtfilt.

As an example, a simple way to go about this would be:

[b,a] = butter(n, Wc) % low pass Butterworth filter with cutoff pi*Wc radians - choose the order of the filter n and cut-off frequency Wc to suit
filtered_data = filter(b,a,original_data);
like image 139
am304 Avatar answered Dec 05 '25 10:12

am304



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!