91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.12MB
    文件類(lèi)型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-08-30
  • 語(yǔ)言: C/C++
  • 標(biāo)簽: 濾波??

資源簡(jiǎn)介

用C語(yǔ)言實(shí)現(xiàn)的Butterworth濾波器,附帶濾波數(shù)據(jù),VC6.0控制臺(tái)程序。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?
using?namespace?std;

#define?????pi?????((double)3.1415926)

struct?DESIGN_SPECIFICATION
{
????double?Passband;???
????double?Stopband;
double?Passband_attenuation;
????double?Stopband_attenuation;
};

//復(fù)數(shù)乘
_complex?ComplexMul(?_complex?a?_complex?b?)
{
_complex?c;
c.x?=?a.x*b.x?-?a.y*b.y;
c.y?=?a.y*b.x?+?a.x*b.y;
return?c;
}

//復(fù)數(shù)除
_complex?ComplexDiv(?_complex?a?_complex?b)
{
_complex?c;
double?dTmp?=?b.x?*?b.x?+?b.y?*?b.y;
//除數(shù)太小防溢出
if(?dTmp? c.x?=?1.0E300;
c.y?=?1.0E300;
return?c;
}
c.x?=?(?a.x?*?b.x?+?a.y?*?b.y)?/?dTmp;
c.y?=?(?a.x?*?b.y?-?a.y?*?b.x)?/?dTmp;
return?c;?
}

//計(jì)算濾波器階數(shù)N
int?Buttord(double?Passband
????????double?Stopband
double?Passband_attenuation
????????double?Stopband_attenuation)
{
???int?N;

???printf(“Wp?=??%lf??[rad/sec]?\n“?Passband);
???printf(“Ws?=??%lf??[rad/sec]?\n“?Stopband);
???printf(“Ap?=??%lf??[dB]?\n“?Passband_attenuation);
???printf(“As?=??%lf??[dB]?\n“?Stopband_attenuation);
???printf(“--------------------------------------------------------\n“?);
?
???N?=?ceil(0.5*(?log10?((?pow?(10?Stopband_attenuation/10)?-?1)/
???(?pow?(10?Passband_attenuation/10)?-?1))?/?log10?(Stopband/Passband)?));
????
???return?(int)N;
}

//計(jì)算S平面的濾波器系數(shù)
int?Butter(int?N?double?Cutoff?double?*a?double?*b)
{
????double?dk?=?0;
????int?k?=?0;
????int?count?=?0count_1?=?0;

????_complex?*poles?*Res?*Res_Save;
poles?=?new?_complex[N]();
????Res???=?new?_complex[N+1]();
Res_Save?=?new?_complex[N+1]();
memset(poles?0?sizeof(_complex)*(N));
memset(Res?0?sizeof(_complex)*(N+1));
memset(Res_Save?0?sizeof(_complex)*(N+1));

????if((N?%?2)?==?0)?dk?=?0.5;
????else?dk?=?0;

????for(k?=?0;k?<=?((2*N)-1)?;?k++)
????{
if(Cutoff*cos((2*k+N-1)*(pi/(2*N)))??????????{ ???
????????????poles[count].x?=?-Cutoff*cos((2*k+N-1)*(pi/(2*N)));
poles[count].y?=?-Cutoff*sin((2*k+N-1)*(pi/(2*N))); ??
?count++;
????????if?(count?==?N)?break;
?????????}
????}?

?????printf(“Pk?=???\n“?);??
?
?????for(count?=?0;?count??????{
???????????printf(“(%lf)?+?(%lf?i)?\n“??-poles[count].x?-poles[count].y);
?????}

?????printf(“--------------------------------------------------------\n“?);
?
?????Res[0].x?=?poles[0].x;?
?????Res[0].y?=?poles[0].y;

?????Res[1].x?=?1;?
?????Res[1].y=?0;

????for(count_1?=?0;count_1?????{
?????for(count?=?0;count?<=?count_1?+?2;count++)
?????{
??????????if(0?==?count)
??{
? ??????????????Res_Save[count]?=?ComplexMul(?Res[count]?poles[count_1+1]?);??
??}

??????????else?if((count_1?+?2)?==?count)
??????????{
????????????????Res_Save[count].x?+=?Res[count?-?1].x;
Res_Save[count].y?+=?Res[count?-?1].y;
??????????} ??
????else?
????{
Res_Save[count]?=?Comple

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2017-04-27?15:55??Butterworth\
?????文件???????48322??2017-04-06?09:27??Butterworth\1.txt
?????文件??????145792??2017-03-27?19:25??Butterworth\123.txt
?????文件??????149793??2017-04-01?15:24??Butterworth\1234.txt
?????文件??????106912??2017-05-01?10:16??Butterworth\butter1.txt
?????文件????????4335??2017-04-06?21:29??Butterworth\Butterworth.dsp
?????文件?????????530??2017-04-04?19:34??Butterworth\Butterworth.dsw
?????文件???????41984??2017-05-01?10:16??Butterworth\Butterworth.ncb
?????文件???????53760??2017-05-01?10:16??Butterworth\Butterworth.opt
?????文件????????1165??2017-05-01?10:16??Butterworth\Butterworth.plg
?????目錄???????????0??2017-04-27?15:55??Butterworth\Debug\
?????文件??????254976??2017-05-01?10:16??Butterworth\Debug\Butterworth.bsc
?????文件??????315455??2017-05-01?10:16??Butterworth\Debug\Butterworth.exe
?????文件??????418012??2017-05-01?10:16??Butterworth\Debug\Butterworth.ilk
?????文件?????2095684??2017-05-01?10:10??Butterworth\Debug\Butterworth.pch
?????文件?????1131520??2017-05-01?10:16??Butterworth\Debug\Butterworth.pdb
?????文件???????28267??2017-05-01?10:16??Butterworth\Debug\main.obj
?????文件???????????0??2017-05-01?10:16??Butterworth\Debug\main.sbr
?????文件??????123904??2017-05-01?10:16??Butterworth\Debug\vc60.idb
?????文件??????110592??2017-05-01?10:16??Butterworth\Debug\vc60.pdb
?????文件???????10932??2017-05-01?10:16??Butterworth\main.cpp
?????文件??????106912??2017-04-06?09:28??Butterworth\output22.txt

評(píng)論

共有 條評(píng)論