After filtering my noisy input signal using an anti-aliasing and FIR filter, I now wish to get the basic signal information (peak voltage and impedance; $R$ and $X$) from the pre-filtered as well as the post filtered signal.

A method to find the peak value that was strongly recommended to me was, Fourier Full Cycle Algorithm (DFT Technique). Not having a firm theoretical grounding yet, (going to take a DSP next semester), I fail to understand the significance of this method, or if this is a better way to find peak values than the ones I've read about such as, taking the first derivative of signal and looking at the zero crossings.

According to this method:

$$V_{sin}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\sin \omega $$

$$V_{cos}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\cos \omega $$

$$V_{peak}=\sqrt{V_{sin}^2+V_{cos}^2} $$


$V_n $ - stored samples of voltage (basically my raw input signal)

$K$ - number of samples chosen per cycle

$\omega=\frac{2\pi n}{K}$ (if $K=60$ samples, then $\omega =6^o $ for $n=1$)

The way I found the peak of the pre-filtered signal (raw-input) was by smoothing it out using a moving average filter using 4 points and then finding the global maxima using statement:

[max_value, index_number]=max(Vn)

I also coded in MATLAB, to find the peak value of voltage using the above mentioned DFT algorithm. The peak values don't match.

My raw input:

enter image description here

Smoothed out data:

enter image description here

I'd be grateful if someone can can tell me if the above mentioned DFT algorithm can even be implemented for an input signal that looks like mine and why the peak values obtained using both the methods don't match. Sorry that I sound confused, I truly am!

Also, a normalised FFT plot of the pre-filtered signal and the code to find peak using Fourier full cycle algorithm, as requested:

enter image description here

K=600; %Number of samples chosen per cycle

while (x<600) theta=(2*pi*angle)/K; f=f+(VolTime(x,2)*sin(theta)); %VolTime is the matrix [601X2],2nd column contains the input voltage values g=g+(VolTime(x,2)*cos(theta)); x=x+1; angle=angle+1; end Vsine= (2/K)*f; Vcos=(2/K)*g; disp('Peak voltage') VPeak=sqrt(Vsine^2 + Vcos^2)
  • $\begingroup$ So, unless the way I have found the peak value by using the smoothing filter is incorrect, both the values should match? $\endgroup$ – userminerva Jul 14 '14 at 17:55
  • $\begingroup$ Show us the result of your DFT. For the method you mentioned, Vsin and Vcos will give zero of k-1 corresponds to integer multiple of the period. Am I missing something/ $\endgroup$ – learner Jul 14 '14 at 22:37
  • $\begingroup$ I have edited the post to show the DFT response. The peak value I am getting with the formulae seems wrong. There seem to be many higher values from the data set. I have taken the K=600[ number of samples i have] and found the summation of Vcos and Vsine for the 600 samples of voltage. How do i get the right peak value? $\endgroup$ – userminerva Jul 15 '14 at 5:10
  • $\begingroup$ No,I understand what the DFT plot gives me and even used that information to determine the cut-off frequency for the FIR filter I designed. The problem is that when I try to compare the peak value of the input voltage signal(calculated the global maxima way I described) with the Vpeak value that I calculate from the above formula ,for K=600, those two values don't tally. I don't get why $\endgroup$ – userminerva Jul 15 '14 at 6:02
  • 1
    $\begingroup$ Er,No. sorry. I have edited the post to include the code... $\endgroup$ – userminerva Jul 15 '14 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.