Thread Subject: Filtering signal with rapid changes with FFT

Subject: Filtering signal with rapid changes with FFT

From: juho salminen

Date: 4 Aug, 2009 07:11:01

Message: 1 of 6

Hi guys,

I'm newbie with signal processing who is trying to implement fft to signal filtering. My problem is following:
My signal is sinusoidial Wave with noise added in it. Wave is decreasing as time passes by.

My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak.
Then I just make ifft of signal.

This technique suits well for stationary sine wave, but when sine's amplitude changes rapidly with time, it seems that when signal is reversed back to time domain, some distortion to amplitudes of reversed signal is introduced. In my application, I need to get amplitudes of signals very accurately!

Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies...

Is there any other ways to do this kind of filter?

Could you guys also make some example code also? My signal processing knowledge is basicly 0

Thanks,

-Juho





 

Subject: Filtering signal with rapid changes with FFT

From: Lorenzo Guerrasio

Date: 4 Aug, 2009 07:55:19

Message: 2 of 6

"juho salminen" <jssalmi3@cc.hut.fi> wrote in message <h58mu4$2o2$1@fred.mathworks.com>...
> Hi guys,
>
> I'm newbie with signal processing who is trying to implement fft to signal filtering. My problem is following:
> My signal is sinusoidial Wave with noise added in it. Wave is decreasing as time passes by.
>
> My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak.
> Then I just make ifft of signal.
>
> This technique suits well for stationary sine wave, but when sine's amplitude changes rapidly with time, it seems that when signal is reversed back to time domain, some distortion to amplitudes of reversed signal is introduced. In my application, I need to get amplitudes of signals very accurately!
>
> Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies...
>
> Is there any other ways to do this kind of filter?
>
> Could you guys also make some example code also? My signal processing knowledge is basicly 0
>
> Thanks,
>
> -Juho
>
>
>
>
>
>

When you multiply (take away) in frequency, you are convolving in time -->high risk of distortion. What you can do is to use FFT to find the peak of the noise and then apply a notch filter.
However, everything depends on the noise features.

Regarding fase distortion, you could use filtfilt

Subject: Filtering signal with rapid changes with FFT

From: juho salminen

Date: 4 Aug, 2009 09:26:01

Message: 3 of 6


"Lorenzo Guerrasio" <lorenzo.guerrasio@email.it> wrote in message <h58ph7$ivr$1@fred.mathworks.com>...
> "juho salminen" <jssalmi3@cc.hut.fi> wrote in message <h58mu4$2o2$1@fred.mathworks.com>...
> > Hi guys,
> >
> > I'm newbie with signal processing who is trying to implement fft to signal filtering. My problem is following:
> > My signal is sinusoidial Wave with noise added in it. Wave is decreasing as time passes by.
> >
> > My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak.
> > Then I just make ifft of signal.
> >
> > This technique suits well for stationary sine wave, but when sine's amplitude changes rapidly with time, it seems that when signal is reversed back to time domain, some distortion to amplitudes of reversed signal is introduced. In my application, I need to get amplitudes of signals very accurately!
> >
> > Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies...
> >
> > Is there any other ways to do this kind of filter?
> >
> > Could you guys also make some example code also? My signal processing knowledge is basicly 0
> >
> > Thanks,
> >
> > -Juho
> >
> >
> >
> >
> >
> >
>
> When you multiply (take away) in frequency, you are convolving in time -->high risk of distortion. What you can do is to use FFT to find the peak of the noise and then apply a notch filter.
> However, everything depends on the noise features.
>
> Regarding fase distortion, you could use filtfilt


"What you can do is to use FFT to find the peak of the noise and then apply a notch filter"

Why a notch filter? Isn't it the same than basicly remove all the noise samples away? Now I'm saving just one peak in frequency domain, I delete everything else. "Peak of the noise" is in this case everything but that peak


My noise is normally distributed (randn-function)

Can you give me an example signal and example of how to use filtfilt-function with this kind of signal so, that there is no amplitude of phase distortion?

Thanks for all the effort!

-Juho

Subject: Filtering signal with rapid changes with FFT

From: Dave Robinson

Date: 4 Aug, 2009 09:45:03

Message: 4 of 6

"juho salminen" <jssalmi3@cc.hut.fi> wrote in message <h58mu4$2o2$1@fred.mathworks.com>...
> Hi guys,
>
> I'm newbie with signal processing who is trying to implement fft to signal filtering. My problem is following:
> My signal is sinusoidial Wave with noise added in it. Wave is decreasing as time passes by.
>
> My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak.
> Then I just make ifft of signal.
>
> This technique suits well for stationary sine wave, but when sine's amplitude changes rapidly with time, it seems that when signal is reversed back to time domain, some distortion to amplitudes of reversed signal is introduced. In my application, I need to get amplitudes of signals very accurately!
>
> Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies...
>
> Is there any other ways to do this kind of filter?
>
> Could you guys also make some example code also? My signal processing knowledge is basicly 0
>
> Thanks,
>
> -Juho

Your basic problem appears to be that the moment you apply amplitude modulation, your signal ceases to be a pure sine wave.

You are in effect taking your time domain sine wave and multiplying by your amplitude modification distribution. In the frequency domain this is equivelent to convolving the Fourier transform of your sine wave (your spike) with the fourier transform of your modulation distribution - which results in a spectrum that is no longer a spike, but has been somewhat smeared. Thus now you kill every frequency component except for the spike, you are throwing away all of the information regarding your modulation distribution and hence you get what you describe as distortion.

The filter you need is not this very narrow spike that you are currently using, but one that corresponds/approximates to the Fourier transform of your amplitude modulated sine wave.

Without knowing anything about the Modulation distribution, this is about as far as I can help.

Regards

Dave Robinson

Subject: Filtering signal with rapid changes with FFT

From: juho salminen

Date: 4 Aug, 2009 10:36:01

Message: 5 of 6

"Dave Robinson" <dave.robinson@somewhere.biz> wrote in message <h58vuv$aee$1@fred.mathworks.com>...
> "juho salminen" <jssalmi3@cc.hut.fi> wrote in message <h58mu4$2o2$1@fred.mathworks.com>...
> > Hi guys,
> >
> > I'm newbie with signal processing who is trying to implement fft to signal filtering. My problem is following:
> > My signal is sinusoidial Wave with noise added in it. Wave is decreasing as time passes by.
> >
> > My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak.
> > Then I just make ifft of signal.
> >
> > This technique suits well for stationary sine wave, but when sine's amplitude changes rapidly with time, it seems that when signal is reversed back to time domain, some distortion to amplitudes of reversed signal is introduced. In my application, I need to get amplitudes of signals very accurately!
> >
> > Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies...
> >
> > Is there any other ways to do this kind of filter?
> >
> > Could you guys also make some example code also? My signal processing knowledge is basicly 0
> >
> > Thanks,
> >
> > -Juho
>
> Your basic problem appears to be that the moment you apply amplitude modulation, your signal ceases to be a pure sine wave.
>
> You are in effect taking your time domain sine wave and multiplying by your amplitude modification distribution. In the frequency domain this is equivelent to convolving the Fourier transform of your sine wave (your spike) with the fourier transform of your modulation distribution - which results in a spectrum that is no longer a spike, but has been somewhat smeared. Thus now you kill every frequency component except for the spike, you are throwing away all of the information regarding your modulation distribution and hence you get what you describe as distortion.
>
> The filter you need is not this very narrow spike that you are currently using, but one that corresponds/approximates to the Fourier transform of your amplitude modulated sine wave.
>
> Without knowing anything about the Modulation distribution, this is about as far as I can help.
>
> Regards
>
> Dave Robinson



Thank you for your response!


well, my signal could look like this (copy and paste to matlab):

%------------------------------------------------------------------------------------

     signalLength = 15000;
     signalFrequency=100;
     samplingFrequency=500;
     T = 1/samplingFrequency; % Sample time
     t = (0:signalLength-1)*T; % Time vector
     beginningPhase = pi;
    e = 2.7182818

  dataVector = e.^(-2*pi*signalFrequency*t*0.001).*(100*sin(2*pi*signalFrequency*t));

originalNoise = 35*randn(1,length(t));
noisyDataVector = dataVector + originalNoise;
                
%-------------------------------------------------------------------------------------------------
    

I was trying to save some values near signal spike in frequency domain (more information for ifft) , but that makes distortions for amplitude due to noise...

Is there a way to still better results ?

Is there ANY way to filter this signal perrfectly or near perfectly? (for example, amplitude distortions always less than 1%)

Subject: Filtering signal with rapid changes with FFT

From: juho salminen

Date: 4 Aug, 2009 10:48:02

Message: 6 of 6

Btw, why worst results appear in the beginning and end of the signal? I mean, after ifft has been done, "modelled" signal follows real signal very badly in the beginning and in the end of signal

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
filter Lorenzo Guerrasio 4 Aug, 2009 03:59:04
filtering juho 4 Aug, 2009 03:58:19
fft filtering juho 4 Aug, 2009 03:58:19
fft juho 4 Aug, 2009 03:58:19
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com