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

資源簡介

本代碼是用c語言編寫的實(shí)現(xiàn)butterworth濾波器,可以對低通,高通,帶通,帶阻四類濾波器進(jìn)行設(shè)計(jì)。

資源截圖

代碼片段和文件信息

/*濾波器設(shè)計(jì)說明:
截止頻率設(shè)計(jì)在omegac=10附近
巴特沃斯幅頻是任意階數(shù)
巴特沃斯相頻只做了2階
切比雪夫幅頻做的是4階
切比雪夫相頻做的是2階
低通?高通?帶通帶阻?通過參數(shù)函數(shù)原型采用參數(shù)替換全部實(shí)現(xiàn)
典型參數(shù)設(shè)置:
巴特沃斯低通?高通:f1=5N=6;
貝特沃斯帶通?帶阻:f1=5f2=10N=6;
切比雪夫低通?高通:f1=5
切比雪夫帶通?帶阻:f1=5*/
#include?“conio.h“
#include?“dos.h“
#include?“stdio.h“
#include?“graphics.h“
#include?“math.h“
#define?UP??????0x48
#define?DOWN????0x50????????????????????????????????????????????
#define?ENTER???0x0D
#define?ESC?????0x1B
#define?LU??????‘\xda‘??????????/*制表符,LU就是leftup*/
#define?RU??????‘\xbf‘
#define?H???????‘\xc4‘
#define?V???????‘\xb3‘
#define?LD??????‘\xc0‘
#define?RD??????‘\xd9‘

/*以下是兩種濾波器的幅頻和相頻曲線函數(shù)共2*2*4=16個(gè)*/
void?low_pass_1(float?afloat?bfloat?c);???????????????????/*巴特沃斯幅頻*/
void?low_pass_12(float?afloat?b);??????????????????????????/*巴特沃斯相頻*/
void?low_pass_2(float?afloat?b);??????????????????????? /*切比雪夫幅頻*/
void?low_pass_22(float?afloat?b?);?????????????????????????/*切比雪夫相頻*/
?

float?input(int?x?int?y?char*?title);
????????????????????????/*輸入一個(gè)浮點(diǎn)數(shù),(xy)是輸入框顯示的位置,title是標(biāo)題*/
void?frame(int?x1int?y1int?x2int?y2int?colorchar*?title);
????????????????????????/*畫一個(gè)帶邊框的窗口,并且把光標(biāo)放在邊框里面第一個(gè)*/
void?moveCursorToEnd();?/*將光標(biāo)移動到最后*/

int?waveFilter?=?1;?????/*濾波器編號,有2個(gè)濾波器可供選擇*/
int?mode?=?1;???????????/*模式,每個(gè)濾波器有低通?高通?帶通?帶阻4種模式*/
float?arg1=?0;?????????/*f1*/
float?arg2?=?0;????????/*f2,并不是每個(gè)濾波器都要輸入*/
float?arg3?=?0;?????/*濾波器階數(shù)*/

int?graphdriver=DETECT;
int?graphmodexy;

int?selWaveFilter();????/*1.選擇濾波器*/
int?selMode();??????????/*2.選擇模式*/
void?inputArgs();???????/*3.輸入?yún)?shù)*/
int?checkArgs();????????/*4.檢查輸入的參數(shù)是否合法,如果合法,返回1*/
void?drawGraph();???????/*5.畫圖*/


void?main()
{?????????????registerbgidriver(EGAVGA_driver);?
????while(1)
????{
????????frame(118025GREEN“Simulated?Wave?Filter“);
????????waveFilter?=?selWaveFilter();
????????if(waveFilter?==?3)?????/*用戶選擇了Exit*/
????????????return;
????????mode?=?selMode();
????????if(mode?==?5)???????????/*用戶選擇模式時(shí)按下了ESC*/
????????????continue;
????????do
????????{
????????????inputArgs();
????????}while(checkArgs()?!=?1);
????????drawGraph();
????}
}

int?selWaveFilter()
{
????char????item[3][32]={“Butterworth““?Chebyshev““???Exit“};
????int?????chiselected=0;
????frame???(302446GREEN““);
????while(1)
????{

????for(i=0;i<3;i++)
????{
????????window(31i+343i+3);
????????if(selected==i)
????????{
????????????textbackground(LIGHTGRAY);
????????????textcolor(YELLOW);
????????}
????????else
????????{
????????????textbackground(GREEN);
????????????textcolor(WHITE);
????????}
????????clrscr();
????????gotoxy(21);
????????cprintf(“%s“item[i]);
????}
????moveCursorToEnd();
????if((ch=getch())==0)
????????ch=getch();
????if(ch==UP)
????{
????????selected--;
????????if(selected==-1)
????????selected=2;
????}
????if(ch==DOWN)
????{
????????selected++;
????????if(selected==3)
????????selected=0;
????}
????if(ch==ENTER)
????????return?selected?+?1;
????}
}

int?selMode()?

評論

共有 條評論

相關(guān)資源