필터 지우기
필터 지우기

Problem with sampling frequency in freqz and fvtools

조회 수: 7 (최근 30일)
Ali Alsaqqa
Ali Alsaqqa 2013년 6월 27일
I am trying to use `fvtool` function in Matlab (2011a).
This is an interactive "tool" composed of many functions. My code goes like this:
%fs1=256; fs2=64; fs3=32;
b1 = fir1(52,0.25,kaiser(53,7.85726));
b2 = fir1(40,0.5,kaiser(41,7.85726));
b3 = fir1(204,0.5,kaiser(205,10.0613));
fvtool(b1,1,b2,1,b3,1);
This produces:
Now I go to the "analysis" menue and choose "sampling frequency", and enter the sampling freq. for each filter. The result is:
Not very good, since the response of the second and third filters is repeating. The response of the first filter is fine, going from 0 to 256/2=128 Hz. I would like to have the response of the second and third filters to go up to 64/2=32 and 32/2=16. respectively.
So I tried to manually do it,
%Digital filter:
fs1=256; fs2=64; fs3=32;
b1 = fir1(52,0.25,kaiser(53,7.85726)); b1(end+256)=0;
b2 = fir1(40,0.5,kaiser(41,7.85726)); b2(end+448)=0;
b3 = fir1(204,0.5,kaiser(205,10.0613)); b3(end+480)=0;
%Filters Response
n=1024;
w = logspace(-1,2,n);
digi_1 = freqz(b1,1,n,fs1); emilogx(w,20*log10(abs(digi_1)),'Color','k');
hold on
digi_2 = freqz(b2,1,n,fs2); emilogx(w,20*log10(abs(digi_2)),'Color','b');
hold on
digi_3 = freqz(b3,1,n,fs3); emilogx(w,20*log10(abs(digi_3)),'Color','r');
axis ([0.1 128 -140 10])
Here I used freqz and give it the filter numerator and denomenator, plus the number of points n, plus the sampling freq. fs. The problem is that Matlab does not seem to do any change with or without the sampling freq., i.e. if I left it nothing change.
So if someone wants to help, he/she would either help me with `fvtools` or with my manual code which is a step late than `fvtools`.
  댓글 수: 1
Ali Alsaqqa
Ali Alsaqqa 2013년 6월 27일
Or if anyone can guide me as to where can I find the internal implementation of fvtool, so that I may see what functions it calls and try to better understand it.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ali Alsaqqa
Ali Alsaqqa 2013년 6월 27일
I tried the gcf to get the handle of the figure and then try to see how the data in the fvtool figure look like. The strange thing is that although the figure has 8192 points, the data were at most 1*16 arrays!

카테고리

Help CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by