フィルターのクリア

i want to implement kaiser window for given data . but always give following error (i-e ??? Error using ==> fir1 at 77 Frequencies must be increasing. Error in ==> kieser at 23 hn=fir1(N-​1,Fc,kaise​r(N,beta))​).followin​g is my code.

1 回表示 (過去 30 日間)
As=40;
passbandfreq=0.01;
transitionwidth=500;
fsamp=10000;
Fn=fsamp/2
fc=1200;
fc1=fc+normalizedtransitionwidth/2
fc2=fc-normalizedtransitionwidth/2
Fc1=fc1/Fn
Fc2=fc2/Fn
Fc=[Fc1,Fc2]
fcn=Fc/Fn
normalizedtransitionwidth=500/Fn
passbandfreq=10^(passbandfreq/20)-1
stopbandfreq=10^(-As/20)
delta=min(passbandfreq,stopbandfreq)
A=-20*log10(delta)
N=A-7.95/14.36*normalizedtransitionwidth
%%for A>=21dB and A<50dB
beta=0.5842*(A-21)^0.4+0.07886*(A-21)
hn=fir1(N-1,Fc,kaiser(N,beta))
[H,f]=freqz(hn,1.512,Fsamp)
anyone help please what should i do with frequency values in which error ocurred???

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 17 日
編集済み: Walter Roberson 2015 年 8 月 17 日
Your code does not define normalizedtransmissionwidth until after it uses it.
Your N is not even close to being an integer -- it is about 58.715923542593 . Is using that as the number of points for a kaiser window defined? Is using 58.715923542593 as the order for the hamming window for fir1() defined?
Perhaps you should use kaiserord to estimate the parameters for fir1()
  1 件のコメント
lione felus
lione felus 2015 年 8 月 17 日
編集済み: lione felus 2015 年 8 月 17 日
now i have used kaiserrord command but now its giving error that stop band frequency should be zero.how should i fix it?(i-e ??? Error using ==> kaiserord at 81 Stopbands must be zero.Error in ==> kieser at 26 [N,Wn,beta,ftype] = kaiserord(Fc,mags,devs,fsamp);)
following is code with kaiserrord command
As=40;
passbandfreq=0.01;
transitionwidth=500;
fsamp=10000;
Fn=fsamp/2
fc=1200;
fc1=fc+normalizedtransitionwidth/2
fc2=fc-normalizedtransitionwidth/2
Fc1=fc1/Fn
Fc2=fc2/Fn
Fc=[Fc1,Fc2]
fcn=Fc/Fn
mags1=1+passbandfreq
mags2=1-passbandfreq
mags=[mags1,mags2]
normalizedtransitionwidth=500/Fn
passbandfreq=10^(passbandfreq/20)-1
stopbandfreq=10^(-As/20)
delta=min(passbandfreq,stopbandfreq)
A=-20*log10(delta)
N=A-7.95/14.36*normalizedtransitionwidth
%%for A>50dB
beta=0.1102*(A-8.7)
devs = [0.05 0.01];
[N,Wn,beta,ftype] = kaiserord(Fc,mags,devs,fsamp);
hh = fir1(n,Wn,ftype,kaiser(N+1,beta),'noscale');
freqz(hh)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeKaiser についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by