How can I do/implement Low pass filter function in matlab?

Hi !
how can I use/do LOW PASS FILTER in matlab? I want to determine as inputs the cut off frequency .. and I want also as second input to enter to LOW PASS FILTER the signal (it's a vector) , so Im trying to do LOW PASS FILTER function called function Low_Pass_Filter(first input the cutoff frequency that I want to input it to my LOW PASS FILTER, Second input is the signal which it's a vector 1X10k size) .. any help please how can I do that in matlab?
thanks alot!

1 comentario

type fdatool in matlab command prompt and there you will get all options for realizing a filter

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 22 de Jun. de 2020
This is already available in the lowpass function (introduced in R2018a).
Otherwise, it is straightforward to define filters with the Signal Processing Toolbox functions. Note that you need to define the sampling freuqency of the signal in order to define the cutoff frequency correctly.

4 comentarios

how could I do that in matlab? any refernce for the matlab code of low pass filter?
for your second note, maybe you could attach an example by matlab code? thanks and appreciated
You are welcome to explore the lowpass code on your own at your leisure.
Here is some archive example code, with the time vector ‘t’ and ‘signal’ the vector to be filtered:
Fs = 1/mean(diff(t)); % Sampling Frequency
L = numel(t); % Signal Length
Fn = Fs/2; % Nyquist Frequency
Wp = 0.05/Fn; % Passband Frequency (Normalised)
Ws = 0.06/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 60; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Elliptic Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp,'low'); % Elliptic Filter Design: Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
signal_filt = filtfilt(sos, g, signal); % Filter Signal
Note that this code has a passband frequency of 0.05 Hz and a stopband frequency of 0.06 Hz. Use values that make sense in your application.
See the documentation for the various functions to understand how they work, and the reason I use them.
This is one of many examples of filter design I have posted over the years. For more of them, search Answers.
.
Mohamed Jamall
Mohamed Jamall el 22 de Jun. de 2020
Editada: Mohamed Jamall el 22 de Jun. de 2020
THANKS ALOT!
I understand the code, but there's something that Im missing, lets assume my frequency of transmitted data(I transmit RF PACKETS) is 868MHZ, symbol rate (bit rate) is 50Kbouad , sampling frequency is 2048K .
so if I want to do my Low Pass filter that the cut off of my LPF will be 50KBOAUD , what should I do? here's my problem. I want that my cutoff frequency of my LPF to be my symbol rate ..
thanks in advance for any assistance! appreciate!!!!
My code is intended for signal processing, not communications. I have essentially no experience with digital communications protocols. You will need to experiment to be certain my code does what you want in your application.

Iniciar sesión para comentar.

Categorías

Más información sobre Signal Processing Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Jun. de 2020

Comentada:

el 2 de Nov. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by