What is the best way to deal with the filter coefficients? - page 2

 

Today a banned friend of ours shared on Skype a link to the free Matlab analogue http://www.scilab.org/

I'll have to see what it is.

Anyway, during installation it says it uses Intel libraries (Intel MKL library has been free for already a year), which is good news.

-----------

If during the software installation steps, you opt to select the Intel MKL

library and/or the FFTW3 library provided in the Intel MKL library, the

installation and use of the Intel MKL library is subject to the Intel EULA [1].

to which you then agree to be bound.

Home - Scilab
Home - Scilab
  • Scilab Enterprises
  • www.scilab.org
Scilab Official Website
 
Timur Gatin:

A digital method generator?

In general, I'm all for a window sink filter.


It uses dlls from intel and lapack package. By the way, only for the second time in my life I've seen a dll being let into the kodobase! After all, MKs have always been against such potentially unsafe steps.

Maybe they'll let me in too? There's a lot of interesting stuff in the works.

 
How many of these odds are there? It would be good to see them all, i.e. option 1 (textual). Also options 2 and 5 would be helpful
 

I don't quite understand about the filter coefficients. The filter coefficients, starting from 2nd order, are non-linearly dependent on the cut-off frequency, or if you like, the smoothing period.

If you give specific coefficients, does that mean for some specific frequencies (periods)? Do I understand it correctly?

 
Alexey Volchanskiy:

Today a banned friend of ours shared on Skype a link to the free Matlab analogue http://www.scilab.org/

I'll have to see what it is.

Anyway, when installing it, it says it uses Intel libraries (Intel MKL library has been free for a year already), which is good.

It's good stuff - a free analogue of MathLab. It is even mostly compatible, i.e. MathLab programs go into SciLab and vice versa. I haven't tried it, but that's what it declares.

Influenced by Sanych, I started with R, but it doesn't suit me very well in general, so in the end I came to SciLab. Initially it was designed to process signals for radio engineering tasks, and it's a bit closer to me). And the statistics in SciLab are also quite sufficient.

 
Yuriy Asaulenko:

I don't quite understand about the filter coefficients. The filter coefficients, starting from 2nd order, are non-linearly dependent on the cut-off frequency, or if you like, the smoothing period.

If you give specific coefficients, does that mean for some specific frequencies (periods)? Do I understand it correctly?


Not really. If you take real frequencies for the calculations, and set the bandwidth in Hz, it will still be converted to a normalised frequency of 0 to 1. And this normalised frequency is no longer dependent on the sampling rate, nor on the real values in Hz.

The real example for trading is a sampling rate of 4Hz, i.e. the timer runs with a period of 250ms. Bandwidth of low pass filter LPF (analogue of muving) is 0.04-0.4 Hz. Convert everything to normalized frequency, just divide all frequencies by the sampling frequency, we get a bandwidth of 0.01-0.1.

The coefficients look like this

double coeff[77] = {
0.0020403288714222, 0.0009819655397928, 0.0011225519005867, 0.0011964370038970, 0.0011779675029415, 0.0010436596580495, 
0.0007732498419909, 0.0003535344421556, -0.0002219434905004, -0.0009469112562786, -0.0018062225251740, -0.0027691214309082, 
-0.0037944927090922, -0.0048248454791543, -0.0057936459361424, -0.0066213616961954, -0.0072249511520868, -0.0075155986002137, 
-0.0074086882831938, -0.0068221975313534, -0.0056865034528597, -0.0039448978330095, -0.0015624214733406, 0.0014713627928496, 
0.0051450870992394, 0.0094188377587497, 0.0142247666794483, 0.0194626330409670, 0.0250204215515161, 0.0307523534113099, 
0.0365038435854891, 0.0421106663853138, 0.0474013760205897, 0.0522124336902514, 0.0563870184354613, 0.0597902427400937, 
0.0623061126904552, 0.0638517409542778,
0.0643721286293195, // центр симметрии
 0.0638517409542778, 0.0623061126904552, 0.0597902427400937, 
0.0563870184354613, 0.0522124336902514, 0.0474013760205897, 0.0421106663853138, 0.0365038435854891, 0.0307523534113099, 
0.0250204215515161, 0.0194626330409670, 0.0142247666794483, 0.0094188377587497, 0.0051450870992394, 0.0014713627928496, 
-0.0015624214733406, -0.0039448978330095, -0.0056865034528597, -0.0068221975313534, -0.0074086882831938, -0.0075155986002137, 
-0.0072249511520868, -0.0066213616961954, -0.0057936459361424, -0.0048248454791543, -0.0037944927090922, -0.0027691214309082, 
-0.0018062225251740, -0.0009469112562786, -0.0002219434905004, 0.0003535344421556, 0.0007732498419909, 0.0010436596580495, 
0.0011779675029415, 0.0011964370038970, 0.0011225519005867, 0.0009819655397928, 0.0020403288714222};

And here's an example picture for three LF filters with different frequency ranges, respectively, different lengths.

fir3

EURUSD, 15.03.2017, sample rate 2 Hz, suppression 40 dB

 
Yuriy Asaulenko:

If you give specific coefficients, does that mean for some specific frequencies (periods)? Do I understand it correctly?

I have now made a Matlab program for myself, which writes a set of arrays of coefficients into a file in double format. Parameters of arrays and their quantity can be set in parameters.

And there's an MQL class that can read the required set.

This is how I will post it. Plus I'll complete the class to be able to select the required set of coefficients and write to disk in binary and text form.

 
Yuriy Asaulenko:

It's a good thing - a free analogue of MatLab. It is even mostly compatible, i.e. MatLab programs go into SciLab, and vice versa. I haven't tried it, but it's declared so.

Influenced by Sanych, I started with R, but it doesn't suit me very well in general, so in the end I came to SciLab. Initially it was designed to process signals for radio engineering tasks, and it's a bit closer to me). And the statistics in SciLab are also quite sufficient.

I'm not familiar with it, as there was no need. Well, nothing, we will study it quickly).
 
Alexey Volchanskiy:

I now have a Matlab program for myself, which writes a set of arrays of coefficients into a file in double format. The parameters of the arrays and their number can be set in the parameters.

And there's an MQL class that can read the required set.

This is how I will post it. In addition, I'll improve the class to be able to select the required set of coefficients and write them to disk in binary and text form.

So, judging by number of coefficients, you use FIR filters?

I use BIH - there are not many coefficients there, but from the normalized form the frequency is more difficult to recalculate. They don't scale that easily.

 
Alexey Volchanskiy:
I'm not familiar with it at all, as I haven't needed to. It's OK, we'll study it quickly.)
If you're in MathLab, there's no problem. At least with the libraries common to both. But whether it makes sense to change a piece of cake for a piece of cake, because they are very close in functionality - I don't know.