Convert online calculator to Excel format

artz

Well-known Member
Joined
Aug 11, 2002
Messages
830
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I need to filter some time series data gathered during an experiment. Column A is Time starting at 0 increasing in 0.1s increments. Column B is voltage data. The number of data rows varies.

I found an online program that calculates digital filter coefficients for a selected filter type, cutoff frequency, and filter order.

My input parameters were filter type= Butterworth highpass, cutoff frequency= 0.1Hz, and filter order = 3. The calculator returned a generic output:

Recurrence relation:
Rich (BB code):
 y[n] = ( -1 * x[n- 3])
     + (  3 * x[n- 2])
     + ( -3 * x[n- 1])
     + (  1 * x[n- 0])

     + (  0.9875122361 * y[n- 3])
     + ( -2.9749461327 * y[n- 2])
     + (  2.9874336501 * y[n- 1])

Also, is the following C code from the output:

Rich (BB code):
/* Digital filter designed by mkfilter/mkshape/gencode   A.J. Fisher
   Command line: /www/usr/fisher/helpers/mkfilter -Bu -Hp -o 3 -a 1.0000000000e-03 0.0000000000e+00 -l */

#define  NZEROS 3
#define  NPOLES 3
#define  GAIN   1.006302976e+00

static float xv[NZEROS+1], yv[NPOLES+1];

static void filterloop()
  { for (;;)
      { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; 
        xv[3] = next input value / GAIN;
        yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; 
        yv[3] =   (xv[3] - xv[0]) + 3 * (xv[1] - xv[2])
                     + (  0.9875122361 * yv[0]) + ( -2.9749461327 * yv[1])
                     + (  2.9874336501 * yv[2]);
        next output value = yv[3];

Can anyone in the Forum convert either of these outputs to either Excel formulas or VBA?

Any help is appreciated.

Thanks,

-Art
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top