Question

I have a current signal and my task is to extract the first 5 harmonics and display the waveforms corresponding to those harmonics.

Here is the fft of the cureent signal so you can visualise where the waveforms are and their relative heights:

enter image description here

( disregard the y scale -- it hasn't been corrected yet )

So this is what I did to solve this:

I made five 4th order butter bandpass filters to extract each harmonic :

orderN = 4;

% Fundamental frequency 
passband1 = [40 60]/(samplingRate/2);
[b,a] = butter(orderN, passband1, 'bandpass');
I1 = filter(b,a,I);

subplot 511
plot(I1,'r');

% Second harmonic
passband2 = [98 102]/(samplingRate/2);
[b2,a2] = butter(orderN, passband2, 'bandpass');
I2 = filter(b2,a2,I);

subplot 512
plot(I2,'b');

% Third Harmonic
passband3 = [146 154]/(samplingRate/2);
[b3,a3] = butter(orderN, passband3, 'bandpass');
I3 = filter(b3,a3,I);

subplot 513
plot(I3,'g');

% Fourth Harmonic
passband4 = [190 210]/(samplingRate/2);
[b4,a4] = butter(orderN, passband4, 'bandpass');
I4 = filter(b4,a4,I);

subplot 514
plot(I4,'m');

% Fifth Harmonic
passband5 = [240 260]/(samplingRate/2);
[b5,a5] = butter(orderN, passband5, 'bandpass');
I5 = filter(b5,a5,I);

subplot 515
plot(I5,'k');

For some weird reason this is the plot that I am getting :

enter image description here

I cant explain those bumps in the plot. Why are those waveform amplitudes increasing and decreasing like that ?

Here is what it is supposed to look like:

enter image description here

( disregard the scales please )

How can I make my filter output to look like the second picture ??

Please help

Was it helpful?

Solution 2

Ok folks I got it working. I plotted the FFT of each filtered signal ( I1,I2,I3,I4,I5 ) and saw this :

http://i.imgur.com/WNx8ZoS.jpg

This plot shows me that the filtering has worked and each harmonic has been filtered out.

Now each harmonic is a sin wave. So all I did was find the amplitude of each harmonic from the fft plot and the frequency at which it is present and made it into a sin wave

and now I am getting the correct plot

OTHER TIPS

I think there are two things:

If I remember correctly, for passband and stopband, MATLAB designs 2*n order filter for you. Type: help butter and verify.

Second thing:

When you apply a filter, two things happen:

The first is the transient response, which is like a negative exponential The second is the steady state response, which is after the transient dies.

If you look at your signals, the more they go from 0, the more "steady" they become. It is like you have an exponentially dying sine wave on top of your wave.

One more thing: Your FFT is showing the x-axis as "Hz". If that is correct, be careful with your filter design.

I believe you are passing w, not f. You are passing 2*pi*f. Again, help butter should specify that.

So your filters are off, and the "spiking" waves are getting filtered, only it is taking time for them to die.

This might be due to FFT Windowing. http://en.wikipedia.org/wiki/Window_function

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top