Low Pass filter on a digital signal in matlab - matlab

I am new to using matlab and signal processing in general and can't figure out how to implement a low pass filter. I have these digital signal that's a vector and would like to run it through a low pass fiter of 40hz or if at all possible a bandpass filter .53-40hz (12db/oct). I have access to the signal processing toolbox but can't figure out how. Any help is appreciated.

There is more then one option to applying a digital filter in Matlab. The doc is very good, so it is a good starting point to look at it and follow the examples:
Applying 1D digital filter
Using conv for filtering using a FIR filter
FIR filter design
IIR filter design

Related

How do I properly design a digital FIR filter?

I want to design a series of optimal filters for ultrasonic signals. The filter order is fixed at 16 and I want the filter to have a passband for a list of ranges, i.e. (16kHz-38kHz, 17kHz-39kHz etc.). I've been using Matlab's Filter Designer and trying to different design inputs in a trial and error manner. What method can I use to find the optimal filter design algorithm (Remez, least-windows or something else) rather than haphazardly throwing inputs to the wall and seeing what looks best (I'm looking for a filter that best attenuates in the stopbands and has a flat frequency response in the passband, given my filter order constraint).
16 taps is not much to work with for an FIR filter, so I'm a dubious whether satisfying results are possible with any design. That said, I suggest trying Remez, aka Parks–McClellan optimal FIR filter design. See Matlab's firpm function. FIR filters designed by the Remez algorithm are "optimal" in the sense of minimizing the maximum pointwise error. Anthor plus about Remez is it allows setting different importance on each band, which could be useful to balance the tradeoff between passband flatness vs. stopband attenuation.

Noisy Signal in Data (FFT) - MATLAB

I am plotting some data I collected at 10000 Hz, I attached a snip of some of the data in the form of an FFT and time. I am getting a repeating frequency around 10Hz that seems to be pretty obviously some sort of noise from the system i am testing. The signal shows up in the time domain and also the frequency domain.
I am looking to use MATLAB to remove these spikes.
Has anyone dealt with a similar issue and can provide any advice.
To filter out specific frequency components of a signal, you would normally use either a notch filter or a comb filter, for which MATLAB already has some commands in the DSP System Toolbox:
https://www.mathworks.com/help/dsp/ref/iirnotch.html
https://www.mathworks.com/help/dsp/ref/fdesign.comb.html
Alternatively, if you have the Signal Processing Toolbox, you can use the band-stop Butterworth filter to remove individual frequency components (ranges) using
https://www.mathworks.com/help/signal/ref/butter.html

Deconvolution of a signal by using Wiener filter

Could anybody explian how to use Wiener filter to revocer the audio signal from low-pass filter in Matlab?
I filtered the signal, after that I used simple deconvolution by dividing filtered signal with frequency response of the LPF, but it didnt give me any result. I didnt get restoration at all. I have checked the LPF, it works correct. I need some information about using Wiener filter for audio files, but there are only answers about deblurring images. Thank you in Advance!
I will attempt to provide some help.
You should study the normal equations as per section 11.11
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-011-introduction-to-communication-control-and-signal-processing-spring-2010/readings/MIT6_011S10_chap11.pdf
This set of equations will appear in every literature on the Wiener filter. The objective regardless of the application is to compute from a noisy observation signal a clean - but reconstructed - version of the clean input signal. Since this is a mathematical model, the quality of the reconstruction is based on how good are the computed statistics and characteristics of the "noise". Noise in audio is always uncorrelated statistically to the clean signal. This is the principle upon which the Wiener filter works.
Figure 11.3 gives an example of deconvolution in block diagram form that should suffice to solve your application in audio. A real Wiener filter minimizes the MMSE ratio as defined in 11.37. That is the difference in expectation of the square of the e(t) process.

How to get the low, middle and high frequency components of an image?

I am currently looking into some image processing project and just wondering how to obtain the low, middle and high frequency components of an image? For example, as this picture showed (I got it from googling without detailed description how to obtained this picture, but presumably using some filtering).
Also, I came across this post of using discrete cosine transform (DCT), and it can help us to get the low and high frequency components of an image. Just wondering how to use DCT to get the middle frequency component?
Link of DCT
I also have very basic knowledge about filtering. I think there are also Gaussian high/low pass filters available to use. And also wavelet based filtering. Just wondering what are the differences between Gaussian, Wavelet and DCT based filtering? Which one should I use?
Typical steps would be:
use a Fourier Transform to bring the image into frequency domain
apply filtering by zero-ing out areas of the fft image
reverse the fourier transform to bring image back to spatial domain
This is a really good example of high/low/mid pass filters in frequency domain: http://paulbourke.net/miscellaneous/imagefilter/
You will want to use MatLab's built in fft our fast fourier transform function. Fourier transforms are an extremely powerful method to filter frequencies. http://www.mathworks.com/help/matlab/ref/fft.html has some great examples on how to use the fft. Once you find the frequencies that make up the image you can take out the undesired frequencies to fit and then reverse fourier transform to obtain the new image.

Kalman filter to smooth accelerometer signals using rotation matrix

I have 3D accelerometer signals which are obviously noisy. I am trying to use Kalman filter to remove bias and drift from these signals. As an extra input I have rotation matrix.
I can also use a moving average filter and it will be fine but how can I use Kalaman filter to smooth these signals using rotation matrix?
Best Regards
Chintan
Please have a look the documentation how to use scalar Kamlan Filter:
http://www.swarthmore.edu/NatSci/echeeve1/Ref/Kalman/ScalarKalman.html
If you can run the code in Matlab and see how the scalar Kalman Filter works:
http://www.swarthmore.edu/NatSci/echeeve1/Ref/Kalman/scalarkalman.m
Once you are familiar with the basic and use of scalar kalman filter then you can follow the practical implementation guide:
http://robotsforroboticists.com/kalman-filtering/
Rotation is included and the linear model is replaced by a general one. Next two filters are combined and finally the federated Kalman Filter is included:
http://campar.in.tum.de/Chair/KalmanFilter