Questions on filter coefficient and fir
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
edgate16 texas instrument
am 20 Okt. 2016
Kommentiert: edgate16 texas instrument
am 21 Okt. 2016
% FIR Low pass filters using rectangular, triangular and kaiser windows % sampling rate - 8000 order = 30; cf=[500/4000,1000/4000,1500/4000]; cf--> contains set of cut-off frequencies[Wc ] % cutoff frequency - 500 b_rect1=fir1(order,cf(1),boxcar(31)); Rectangular b_tri1=fir1(order,cf(1),bartlett(31)); Triangular b_kai1=fir1(order,cf(1),kaiser(31,8)); Kaisar [Where 8-->Beta Co-efficient] % cutoff frequency - 1000 b_rect2=fir1(order,cf(2),boxcar(31)); b_tri2=fir1(order,cf(2),bartlett(31)); b_kai2=fir1(order,cf(2),kaiser(31,8)); % cutoff frequency - 1500 b_rect3=fir1(order,cf(3),boxcar(31)); b_tri3=fir1(order,cf(3),bartlett(31)); b_kai3=fir1(order,cf(3),kaiser(31,8)); fid=fopen('FIR_lowpass_rectangular.txt','wt'); fprintf(fid,'\t\t\t\t\t\t%s\n','Cutoff -400Hz'); fprintf(fid,'\nfloat b_rect1[31]={'); fprintf(fid,'%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,\n',b_rect1); fseek(fid,-1,0); fprintf(fid,'};');
Q.1 In the above code the line cf=[500/4000,1000/4000,1500/4000]; Why this has been added? Q.2 what is the formula of Cutoff frequency? Q.3 How the matlab generates the coefficients internally? Q.4.what is the difference between rectangular and Kaisar window other than Beta?
1 Kommentar
Antworten (1)
Jan
am 20 Okt. 2016
Q1. As the comment tells you "cf contains [a] set of cut-off frequencies[Wc]" It has been added, because the programmer needed a set of cut-off frequencies.
Q2. The formula of cut-off frequency depends on the filter parameters.
Q3. Which coefficients? You can look inside the code of the functions. Explaining all of the hundreds of code lines here in the forum would be a bad idea.
Q4. I'm not sure, how to answer this. I'd take a look at https://en.wikipedia.org/wiki/Window_function
Sorry, edgate16 texas instrument, I do not really understand your questions.
3 Kommentare
Jan
am 20 Okt. 2016
"As soon as possible" is inpolite. Do not try to push voluntary helpers.
Q1. The frequencies are normalized by the half sampling rate, which is 8000. Therefore the values are divided by 4000.
Q2. It depends on what exactly "a filter" means: The filter method including the window type and its parameters determine the cut-off frequency.
Q3. Of course there are formulas to calculate the coefficients. You can find the calculations in the code of the functions. Look e.g. in edit kaiser, edit fir1 etc.
Siehe auch
Kategorien
Mehr zu Bartlett finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!