只有春节那么几天才能和家人团聚,看着爸爸妈妈一年比一年老,自己还是一无所有,照顾好自己尚且惭愧,真是悲从中来,又能怎么办呢,

唯有奋发努力,时不我待,多想想怎么赚钱,加油。

《DSP using MATLAB》Problem 7.1-LMLPHP

代码:

function [delta1, delta2] = db2delta(Rp, As)
% -------------------------------------------------
% Converts dB specs Rp and As into
% absolute specs delta1 and delta2
% [delta1, delta2] = delta2db(Rp, As)
% delta1 = passband tolerance ( or ripple), absolute specs
% delta2 = stopband tolerance ( or ripple), absolute specs
% Rp = passband ripple in dB
% As = stopband attenuation in dB
%
temp = 10^(-Rp/20);
delta1 = (1-temp) / (1+temp); delta2 = (1+delta1)*(10^(-As/20));

  

function [Rp, As] = delta2db(delta1, delta2)
% -------------------------------------------------
% Converts absolute specs delta1 and delta2 into
% dB specs Rp and As
% [Rp, As] = delta2db(delta1, delta2)
% delta1 = passband tolerance ( or ripple), absolute specs
% delta2 = stopband tolerance ( or ripple), absolute specs
% Rp = passband ripple in dB
% As = stopband attenuation in dB
% Rp = -20 * log10( (1-delta1)/(1+delta1));
As = -20 * log10( delta2 / (1+delta1));

  运行结果:

《DSP using MATLAB》Problem 7.1-LMLPHP

05-11 11:17