From: Jetson Ronald on
Hello
I am using butter worth bandpass filter to the extract the band of frequencies. I also want to extract a single frequency(e.g. 4Hz) from the signal. I am aware that it could be done using gaussian filter. However, I could not find a way to do that. It could be a nice help if you could help me solve this
Thank you
Ronald
From: Wayne King on
"Jetson Ronald" <ajetsonronald(a)yahoo.co.in> wrote in message <i0kj4o$dd0$1(a)fred.mathworks.com>...
> Hello
> I am using butter worth bandpass filter to the extract the band of frequencies. I also want to extract a single frequency(e.g. 4Hz) from the signal. I am aware that it could be done using gaussian filter. However, I could not find a way to do that. It could be a nice help if you could help me solve this
> Thank you
> Ronald

Ronald, when you say you want to "extract" a single frequency, what exactly are you trying to do? You can say that just getting the Fourier coefficient corresponding to 4 Hz is extracting 4 Hz. Can you be more specific? What is your use case?

Wayne
From: Jetson Ronald on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <i0koop$n87$1(a)fred.mathworks.com>...
> "Jetson Ronald" <ajetsonronald(a)yahoo.co.in> wrote in message <i0kj4o$dd0$1(a)fred.mathworks.com>...
> > Hello
> > I am using butter worth bandpass filter to the extract the band of frequencies. I also want to extract a single frequency(e.g. 4Hz) from the signal. I am aware that it could be done using gaussian filter. However, I could not find a way to do that. It could be a nice help if you could help me solve this
> > Thank you
> > Ronald
>
> Ronald, when you say you want to "extract" a single frequency, what exactly are you trying to do? You can say that just getting the Fourier coefficient corresponding to 4 Hz is extracting 4 Hz. Can you be more specific? What is your use case?
>
> Wayne

Dear Wayne
I am analyzing a broad band signal (.01Hz - 25Hz) which is recorded during the earthquake. Low frequencies ( below .1Hz) are noise and frequencies beyond 15 is not my interest, So I use a bandpass filter to extract the signal with frequencies of my interest.
I want to do the same operation; that is to extract the signal which has frequency 4Hz.
Thank you
From: Wayne King on
"Jetson Ronald" <ajetsonronald(a)yahoo.co.in> wrote in message <i0kqbc$8c0$1(a)fred.mathworks.com>...
> "Wayne King" <wmkingty(a)gmail.com> wrote in message <i0koop$n87$1(a)fred.mathworks.com>...
> > "Jetson Ronald" <ajetsonronald(a)yahoo.co.in> wrote in message <i0kj4o$dd0$1(a)fred.mathworks.com>...
> > > Hello
> > > I am using butter worth bandpass filter to the extract the band of frequencies. I also want to extract a single frequency(e.g. 4Hz) from the signal. I am aware that it could be done using gaussian filter. However, I could not find a way to do that. It could be a nice help if you could help me solve this
> > > Thank you
> > > Ronald
> >
> > Ronald, when you say you want to "extract" a single frequency, what exactly are you trying to do? You can say that just getting the Fourier coefficient corresponding to 4 Hz is extracting 4 Hz. Can you be more specific? What is your use case?
> >
> > Wayne
>
> Dear Wayne
> I am analyzing a broad band signal (.01Hz - 25Hz) which is recorded during the earthquake. Low frequencies ( below .1Hz) are noise and frequencies beyond 15 is not my interest, So I use a bandpass filter to extract the signal with frequencies of my interest.
> I want to do the same operation; that is to extract the signal which has frequency 4Hz.
> Thank you

Hi Ronald, you can just use the Fourier coefficient corresponding to 4 Hz as a maximum likelihood estimate of the amplitude of the 4 Hz component. This is equivalent to a least squares estimate of the amplitude of the 4 Hz component. In the following I have a 4-hz sine wave in noise. First I use regress() from the Statistics Toolbox to get the least squares solution, then using the mldivide operator, finally just using the properly scaled DFTcoefficient. Compare the estimates in beta and beta1 with A, B, and Mu. beta(1), beta1(1), and Mu are the DC estimates. beta(2), beta1(2), and A are the estimates for cos(2*pi*4*t), and finally-- beta(3),beta1(3), and B are the estimates for sin(2*pi*4*t)


Fs = 100;
t = 0:(1/Fs):1-(1/Fs);
reset(RandStream.getDefaultStream);
x = 2*cos(2*pi*4*t)+0.5*randn(size(t));
X = ones(100,3);
X(:,2)=cos(2*pi*4*t)';
X(:,3) = sin(2*pi*4*t)';
[beta,bint,r,rint,stats] = regress(x',X);
% equivalent to
beta1 = X\x';
% compare beta and beta1
% Using the discrete Fourier transform
xDFT = fft(x);
% The DFT bins are spaced at 1 Hz.
Z = 2/length(x)*xDFT(5);
A = real(Z); B =-imag(Z);
Mu = 1/length(x)*xDFT(1); % DC estimate

Hope that helps,
Wayne