Hi Marcin, Thank you very much! I found my error, I forgot the "gain" which is the first parameter to the filter. The first parameter I wrote in the filter method was the "sample_rate" (which was a large number), hence the filter function could not converge. It is all good now, thank you.
I have two questions related to the remez filter (you may or maynot be able to give me an answer(s)): Q1. If I write a line of code to extract the remez taps, say: lpfilter = gr::filter::pm_remez ( int order, const std::vector< double > & bands, const std::vector< double > & ampl, const std::vector< double > & error_weight, const std::string filter_type = "bandpass", int grid_density = 16 ) The pm_remez has a squidly line under it and if I hover it with the mouse, it says gr::filter has no member function pm_remez. (I tried a bunch of different variations of things, but the squidly line remains.) Q2. The doc write up states that the pm_remez filter_types are one of: bandpass, hilbert or differentiator. It seems like a natural for all these filters to provide a lowpass option, what do you think? If I can get rid of the squidly line, I would be able to test if "lowpass" works. Thanks again for all your help. Regards, George On Wed, Feb 23, 2022 at 2:02 AM Marcin Puchlik <m.puch...@is-wireless.com> wrote: > George, > Running the below code: > > > > > > > > > > > > > *#include <iostream>#include <gnuradio/filter/firdes.h>using namespace > std;int main() { cout << "!!!Hello World!!!" << endl; // prints !!!Hello > World!!! std::vector<float> taps = gr::filter::firdes::low_pass(1, 1, 0.3, > 0.1); for(int i = 0; i < taps.size(); i++) cout << "tap " << i << ":" << > "\t" << taps[i] << "\n"; return 0;}* > > *I get the output:* > > !!!Hello World!!! > tap 0: -0.00124749 > tap 1: 0.0026334 > tap 2: -3.313e-18 > tap 3: -0.00722382 > tap 4: 0.00725102 > tap 5: 0.0112526 > tap 6: -0.0272494 > tap 7: 1.54168e-17 > tap 8: 0.0582835 > tap 9: -0.0539706 > tap 10: -0.0877955 > tap 11: 0.298026 > tap 12: 0.600081 > tap 13: 0.298026 > tap 14: -0.0877955 > tap 15: -0.0539706 > tap 16: 0.0582835 > tap 17: 1.54168e-17 > tap 18: -0.0272494 > tap 19: 0.0112526 > tap 20: 0.00725102 > tap 21: -0.00722382 > tap 22: -3.313e-18 > tap 23: 0.0026334 > tap 24: -0.00124749 > > > > > śr., 23 lut 2022 o 02:39 George Edwards <gedwards....@gmail.com> > napisał(a): > >> Hi Marcin and Vasil, >> >> Thank you guys very much! >> >> Marcin: I did as you suggested and left out win_type and beta. >> Vasil: Based on the conversation exchanges between you Marcin, I followed >> your suggestion to link in the gnuradio-filter library - in >> lib/CMakeLists.txt in target_link_libraries() by adding gnuradio-filter. >> Thus, the target_link_libraries in the original OOT lib/CMakeLists.txt >> file was: >> target_link_libraries(gnuradio-ge_filters gnuradio::gnuradio-runtime) >> and I added to it as shown below: >> target_link_libraries(gnuradio-ge_filters gnuradio::gnuradio-runtime >> gnuradio-filter) >> The OOT program compiles and makes the intended Gnuradio block for me to >> load in a GRC flowgraph. For experimental purposes, I made the OOT block to >> output the filter coefficients. When I run the grc, the lowpass filter >> outputs all zeros, so something is wrong! >> Marcin: You had written a piece of code to print "Hello World". Please >> run your code to print out the returned filter coefficients and let me know >> if it works well because mine is having some problems. >> >> This is how I invoked the filter method (all parameters are defined): >> vector <float> lpfilter; //vector variable will contain the filter >> coeff's >> lpfilter = gr::filter::firdes::low_pass(gain, sampling_freq, cutoff_freq, >> transition_bandwidth); >> >> Thank you guys! >> >> George >> >> >> On Tue, Feb 22, 2022 at 3:41 PM Marcin Puchlik <m.puch...@is-wireless.com> >> wrote: >> >>> Geroge, >>> I posted the working code a few messages ago. Try to check this out. BTW >>> as far as I can see those two arguments are optional (window type and >>> beta). Try to run your code without them and check if it works. >>> >>> >>> wt., 22 lut 2022 o 19:25 George Edwards <gedwards....@gmail.com> >>> napisał(a): >>> >>>> Hello Vasil and Marcin, >>>> >>>> Thanks very much for your help. >>>> >>>> I have all the relevant #include header files and invoke the low_pass >>>> filter as follows: >>>> lpfilter = gr::filter::firdes::low_pass(gain, sampling_freq, >>>> cutoff_freq, transition_bandwidth, >>>> fft::window::win_type::WIN_HAMMING, beta); >>>> >>>> Observations: >>>> Using the mouse to hover over WIN_HAMMING, I can see that it >>>> interprets the win_type enum variable and correctly assigns it a value of >>>> "0" (which is the value stated in the Gnuradio C++ API Reference manual). >>>> However, there is a squidly under beta. Hovering over beta, the error >>>> message is: >>>> Argument of type "double" is incompatible with parameter of type >>>> "gr::fft::window::win_type" >>>> >>>> If one of you has a working code fragment using one of the C++ >>>> Gnuradio filter methods that you can cut, paste and send in your next email >>>> I would appreciate it. >>>> >>>> Thanks for your help. >>>> >>>> George >>>> >>>> On Tue, Feb 22, 2022 at 6:15 AM Vasil Velichkov <vvvelich...@gmail.com> >>>> wrote: >>>> >>>>> Hi George, >>>>> >>>>> On 21/02/2022 18.31, George Edwards wrote: >>>>> > lpfilter = gr::filter::firdes::low_pass(gain, sampling_freq, >>>>> cutoff_freq, transition_bandwidth, >>>>> > fft::window::win_type < >>>>> https://www.gnuradio.org/doc/doxygen/classgr_1_1fft_1_1window.html#a599d7e9625d6cc77203a8b877c4911e2>window >>>>> = fft::window::win_type::WIN_HAMMING, beta = 6.76); >>>>> > >>>>> > This failed and showed a squidly across the line with >>>>> fft::window::win_type....! >>>>> >>>>> Try adding "gr::" before "fft::window" and make sure >>>>> gnuradio/fft/window.h is included. >>>>> >>>>> #include <gnuradio/fft/window.h> >>>>> >>>>> lpfilter = gr::filter::firdes::low_pass(gain, sampling_freq, >>>>> cutoff_freq, transition_bandwidth, >>>>> gr::fft::window::win_type window = >>>>> fft::window::win_type::WIN_HAMMING, beta = 6.76); >>>>> >>>>> If this does not fix it then provide the exact error you are getting. >>>>> >>>>> Regards, >>>>> Vasil >>>>> >>>>