Skip to content

In order to obtain the same results as the function 'butter' in MATLAB, uses 'high' and filter order 4 for example

Notifications You must be signed in to change notification settings

wustyuyi/Butterworth_filter_coefficients-MATLAB-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Butterworth_filter_coefficients-MATLAB-in-C

Motivation

In order to obtain the same results as the function 'butter' in MATLAB, uses 'high' and filter order 4 for example

[BB, AA] = butter(4,freq,'high')

How to use

Just include the header file and write your own codes based on the example programs.

  • bwlp.c-lowpass filter coefficient calculator
  • bwhp.c-highpass ilter coefficient calculator
  • bwbp.c-bandpass filter coefficient calculator
  • bwbs.c-bandstop filter coefficient calculator

These are the official guides but i recommend you to check out my example code butter.cpp!

Useful tip

Actually if you have finished the program you might find the result different from that in MATLAB.
Just as the question in STACKOVERFLOW.
This bro indeed has brilliant ability to solve this problem, but i strongly recommend you an easier way.
  The problem is that the result you got from the code hasn't been normalized, and notice that a variable sff either in my example code or in bwhp.c.
If you set that to 1, the problem will be solved.

int sff;  //scale flag: 1 to scale, 0 to scale ccof

btw. Would someone please help me answer the question on stackoverflow?I don't have any reputation lol.

About

In order to obtain the same results as the function 'butter' in MATLAB, uses 'high' and filter order 4 for example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published