資源簡介
貝塞爾高低通濾波器級聯方式系數生成C代碼。 網上找不到的哦,自己編寫驗證的。
代碼片段和文件信息
/*
?*?besself.c
?*?Description:
?*
?*??Created?on:?2014-12-5
?*??????Author:?Graydon
?*??Modify:
?*/
#include?
#define?pi?3.1415926
typedef?enum??
{
bHighPass?
bLowPass?
}BType;
typedef?struct?complex
{
float?r;
float?i;
}complex_t*pcomplex_t;
void?complex_mul(const?complex_t?aconst?complex_t?bpcomplex_t?c)
{
c->r?=?a.r*b.r-a.i*b.i;
c->i?=?a.r*b.i+a.i*b.r;
}
void?complex_add(const?complex_t?aconst?complex_t?bpcomplex_t?c)
{
c->r=a.r+b.r;
c->i=a.i+b.i;
}
//級聯形式
int?bessels(int?nint?fcint?fsint?typefloat?sos[][6]float*?g)
{
int?nsection?=?(n+1)/2;
float?wc=tan(2*pi*fc/fs/2);
complex_t?p[8];//?極點
int?i;
float?a1;
float?constant[]?=?{1.0?1.272?1.413?1.533??1.613?1.735?1.804?1.956};
int?k=0;
if?
評論
共有 條評論