Designing a band pass filter for filtering a sinusoidal function with a known frequency from a signal with an unknown sampling rate
6 views (last 30 days)
Show older comments
Hi,
I have a non-periodic signal which I do not know it's smapling frequency.Just a random signal with an nunkown sampling frequency.
R=rand(2000,1);
I need to filter a first a order fourier function: f(x) = a0 + a1*cos(x*w) + b1*sin(x*w) from singal R. So Filter f(x) from R.
I have all it's coefficents and I know the value for frequecy
a0 = -0.828e-06 ;
a1 = 7.8 ;
b1 = -460 ;
w = 0.00976 ;
the length of x is equal to size(R(1))=2000 points;
the value of the a1 and b1 are unkown .
I need to filter the non -periodic signal ( R) with the function f(x) .
I wnat to use a band pass filter to elimiante all the frequencies associated and close to sinusidoal wave (f(x)) .
Many thanks
0 Comments
Answers (1)
Agnish Dutta
on 20 Mar 2019
Edited: Agnish Dutta
on 20 Mar 2019
The signal processing toolbox will give you the necessary functionality to carry out filtering of signals.
The following will create a bandpass filter:
% To create an FIR filter:
Hd1 = designfilt('bandpassfir', ...
'StopbandFrequency1',1/60,'PassbandFrequency1',1/40, ...
'PassbandFrequency2',1/4 ,'StopbandFrequency2',1/2 , ...
'StopbandAttenuation1',10,'PassbandRipple',1, ...
'StopbandAttenuation2',10,'DesignMethod','equiripple','SampleRate',Fs);
% To create an IIR filter:
Hd2 = designfilt('bandpassiir', ...
'StopbandFrequency1',1/60,'PassbandFrequency1',1/40, ...
'PassbandFrequency2',1/4 ,'StopbandFrequency2',1/2 , ...
'StopbandAttenuation1',10,'PassbandRipple',1, ...
'StopbandAttenuation2',10,'DesignMethod','butter','SampleRate',Fs);
I believe you'll be able to set the parameters to their appropriate values as per your application.
To filter a signal using the above filters:
yfir = filter(Hd1,y);
yiir = filter(Hd2,y);
Links:
Filtering Data With Signal Processing Toolbox Software - https://www.mathworks.com/help/signal/ug/filtering-data-with-signal-processing-toolbox.html
0 Comments
See Also
Categories
Find more on Digital and Analog Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!