06-25-2013 10:08 AM
No problem Bill 😉
I though about it but when you use a low pass and then a high pass, the results are a bit worse than with a Bandpass... Nevertheless, I will try this solution to see if there is the same problem with those filters...
06-25-2013 10:36 AM
Tom_VM,
It is not clear to me why the Equi-Ripple Bandpass Filter.vi is not working. It generates error -20031 for which the possible reasones are: "The filter cannot be designed with the specified input values." That is not a particularly useful error message. Changing Ordre du filtre finds several values for which the filter generates an output. The Detailed help for this VI says it will have an empty array output for any error. It also specifies how many "extra" samples are in the output.
By comparison I connected a Butterworth Filter.vi to your data. I selected Bandpass as the filter type and wired Ordre du filtre, the pass freq controls, and Fe to the appropriate inputs. This filter works over a wide range of settings. The Butterworth filter has a very smooth passband although its transitions to the stop band are slower than many other filter types. The image below has the original data at the top, the Equi-Ripple filter in the middle and the Butterworth filter at the bottom. The graphs on the right show the last 1000 samples so you can see the nosie removal effects. Also note the phase shift. All graphs have the same Y-axis scales. Note the initial transient on the Butterworth filter. All filters have such transients. I suspect that the Equi-ripple may be trying to compensate in some way and that may be where the problem occurs.
This image shows the effect of the Butterworth filter with your default settings (Ordre = 24). The Equi-Ripple VI generates an error at this setting.
It often helps to look at the spectrum of a filtered signal.
Input spectrum
Equi-Ripple Ordre = 3
Butterworth Ordre = 3
Butterworth Ordre = 24
I have enclosed the VI which I modified so you can try various parameters for yourself. Unless you have strong interference in the stopband, I think the Butterworth filter may be adequate for your needs.
Lynn
06-26-2013 01:42 AM
Firstofall, I want to thank you for your work Johnsold.
Then I want to told you that I hadn't though to use the Butterworth filter... I was trying to fix the equi-ripple... without success. With the datas you gave me, I see that the Butterworth filter is better than the equi-ripple for the same order. Although, if the response of the butterworth is a quiet "noisier" than the other, it's not a big deal because I want to create a programm to calculate automaticaly with a high precision the frequency of my input signal. So I use the filter to find (with a linearization) the zero crossing points and calculate the gap between each. I find the frequency with the mean of all the gaps. So I want to have an output signal with only 2 zero crossing points by period. So my signal should be very robust to the noise...
I will try the Vi you sent me with differents configurations to see what kind of output signal I could find.
Thanks you very much !
06-26-2013 08:44 AM
Have you tried frequency domain methods? You might be able to get the data you want by using Extract Single Tone Information.vi from the Signal Processing palette. When I run it on your raw data it returns frequency of 49.999946 Hz, amplitude = 0.99951, and phase = 1.63 degrees. Given the noise on that signal, you probably will not do much better. When I run it on the filtered signal the values are f = 49.885598, A = 0.92794, theta = -57.87.
If you have strong interfering signals the advanced search should help.
This is what I added to the VI I posted the other day.
Lynn
06-26-2013 10:30 AM
No I haven't tried this but it seems to be exactly what I want to do !
But I have a question : What treatment is there in this VI ? How could he find such results with my input signal (sinus 50Hz + 10% noise signal + temporal distorsion on each point) ?
I will work on it to find what kind of functions are behind this...
Thanks a lot for your knowledge, again !
06-26-2013 01:07 PM
You can open the block diagram on the Extract Single Tone Information.vi to see what is in there. Ultimately it uses a Fourier Transform.
The nice thing about using the frequency domain for this kind of problem is that the Fourier transform of the noise is spread over the entire spectrum while all of the signal energy is in one place.
Lynn
06-27-2013 04:38 AM
Hello,
Yesterday, I tried to use the Extract Single Tone Information.VI but I have a problem about the accuracy. On my computer, the frequency is approximated to 50.00 Hz... How could I fix the number of significant numbers to have 50.000001 ? I searched in the subVI about a %Xf but I didn't find it...
Could you please tell me how I can do that ?
Thanks a lot.
In another part, I worked on the Fourier Transform which is perform under the Signle Tone Information.VI and this is quiet clear for me. Thank you for this help.
06-27-2013 06:34 AM
Pop up on the control on the front panel and select Display Format... or Properties from the menu. You can change the number of digits and whether it uses digits of precision or significant digits.
Internally the wire always maintains the full precision of the datatype (~15 digits for DBL).
Lynn
06-27-2013 06:37 AM - edited 06-27-2013 06:37 AM
Thank you very much for this simply little thing...