📄 filter_fixed.m
字号:
function ques1_fixed;
% pass2 - creating quantizer objects
a=quantizer('fixed','round','saturate',[16 14]);
b=quantizer('fixed','round','saturate',[16 14]);
c=quantizer('fixed','round','saturate',[16 14]);
d=quantizer('fixed','round','saturate',[16 14]);
e=quantizer('fixed','round','saturate',[16 14]);
f=quantizer('fixed','round','saturate',[16 14]);
g=quantizer('fixed','round','saturate',[16 14]);
h=quantizer('fixed','round','saturate',[16 14]);
i=quantizer('fixed','round','saturate',[16 14]);
j=quantizer('fixed','round','saturate',[16 14]);
k=quantizer('fixed','round','saturate',[16 14]);
l=quantizer('fixed','round','saturate',[16 14]);
m=quantizer('fixed','round','saturate',[16 14]);
n=quantizer('fixed','round','saturate',[16 14]);
Mixer_Out = ones(1,3);
Buff_Delayline = ones(1,3);
fixed = ones(1,10);
Input_Sig = [0.0642,0.2251,0.4274,0.6430,0.8349,0.9696,1.0089,0.9076,0.6788,0.3610,0.0047,-0.3400,-0.6385,-0.8867];
HF_DEN = [1.0000, -1.0275, 0.7265];
HF_NUM = [0.1367, 0.5, -0.1367];
% pass 2 - using the quantize objects to convert to Q2.14 format
input = quantize(a,Input_Sig);
hf_den = quantize(b,HF_DEN);
hf_num = quantize(c,HF_NUM);
mixerout = quantize(d,Mixer_Out);
buffdelayline = quantize(e,Buff_Delayline);
% pass 1 - levelization has been done inside the for loop
% scalarization hadn't been required. the code was already in that format
'fixed'
for(counter=1:1:10)
Mixer_Out(3) = Mixer_Out(2);
Mixer_Out(2) = Mixer_Out(1);
Mixer_Out(1) = Input_Sig(counter);
Buff_Delayline(3) = Buff_Delayline(2);
Buff_Delayline(2) = Buff_Delayline(1);
temp1 = quantize(f,Mixer_Out(3)*HF_NUM(3));
temp2 = quantize(g,Mixer_Out(2)*HF_NUM(2));
temp3 = quantize(h,temp1 + temp2);
temp4 = quantize(i,Mixer_Out(1)*HF_NUM(1));
temp5 = quantize(j,temp3 + temp4);
temp6 = quantize(k,Buff_Delayline(2)*HF_DEN(2));
temp7 = quantize(l,temp5 - temp6);
temp8 = quantize(m,Buff_Delayline(3)*HF_DEN(3));
Buff_Delayline(1) = quantize(n,temp7 - temp8);
fixed(counter) = Buff_Delayline(1);
end
fixed
end
%
% function ques1_fixed;
%
% % pass2 - creating quantizer objects
% a=quantizer('fixed','round','saturate',[16 14]);
% b=quantizer('fixed','round','saturate',[16 14]);
% c=quantizer('fixed','round','saturate',[16 14]);
% d=quantizer('fixed','round','saturate',[16 14]);
% e=quantizer('fixed','round','saturate',[16 14]);
% f=quantizer('fixed','round','saturate',[16 14]);
% g=quantizer('fixed','round','saturate',[16 14]);
% h=quantizer('fixed','round','saturate',[16 14]);
% i=quantizer('fixed','round','saturate',[16 14]);
% j=quantizer('fixed','round','saturate',[16 14]);
% k=quantizer('fixed','round','saturate',[16 14]);
% l=quantizer('fixed','round','saturate',[16 14]);
% m=quantizer('fixed','round','saturate',[16 14]);
% n=quantizer('fixed','round','saturate',[16 14]);
%
% Mixer_Out = ones(1,3);
% Buff_Delayline = ones(1,3);
% fixed = ones(1,10);
%
% Input_Sig = [0.0642,0.2251,0.4274,0.6430,0.8349,0.9696,1.0089,0.9076,0.6788,0.3610,0.0047,-0.3400,-0.6385,-0.8867];
% HF_DEN = [1.0000, -1.0275, 0.7265];
% HF_NUM = [0.1367, 0.5, -0.1367];
%
% % pass 2 - using the quantize objects to convert to Q2.14 format
% input = quantize(a,Input_Sig);
% hf_den = quantize(b,HF_DEN);
% hf_num = quantize(c,HF_NUM);
% mixerout = quantize(d,Mixer_Out);
% buffdelayline = quantize(e,Buff_Delayline);
%
% % pass 1 - levelization has been done inside the for loop
% % scalarization hadn't been required. the code was already in that format
% 'fixed'
% for(counter=1:1:10)
% Mixer_Out(3) = Mixer_Out(2);
% Mixer_Out(2) = Mixer_Out(1);
% Mixer_Out(1) = Input_Sig(counter);
% Buff_Delayline(3) = Buff_Delayline(2);
% Buff_Delayline(2) = Buff_Delayline(1);
%
% temp1 = quantize(f,Mixer_Out(3)*HF_NUM(3));
% temp2 = quantize(g,Mixer_Out(2)*HF_NUM(2));
% temp3 = quantize(h,temp1 + temp2);
% temp4 = quantize(i,Mixer_Out(1)*HF_NUM(1));
% temp5 = quantize(j,temp3 + temp4);
% temp6 = quantize(k,Buff_Delayline(2)*HF_DEN(2));
% temp7 = quantize(l,temp5 - temp6);
% temp8 = quantize(m,Buff_Delayline(3)*HF_DEN(3));
% Buff_Delayline(1) = quantize(n,temp7 - temp8);
% fixed(counter) = Buff_Delayline(1);
% end
% fixed
% end
%
% function ques1_fixed;
%
% % pass2 - creating quantizer objects
% a=quantizer('fixed','round','saturate',[16 14]);
% b=quantizer('fixed','round','saturate',[16 14]);
% c=quantizer('fixed','round','saturate',[16 14]);
% d=quantizer('fixed','round','saturate',[16 14]);
% e=quantizer('fixed','round','saturate',[16 14]);
% f=quantizer('fixed','round','saturate',[16 14]);
% g=quantizer('fixed','round','saturate',[16 14]);
% h=quantizer('fixed','round','saturate',[16 14]);
% i=quantizer('fixed','round','saturate',[16 14]);
% j=quantizer('fixed','round','saturate',[16 14]);
% k=quantizer('fixed','round','saturate',[16 14]);
% l=quantizer('fixed','round','saturate',[16 14]);
% m=quantizer('fixed','round','saturate',[16 14]);
% n=quantizer('fixed','round','saturate',[16 14]);
%
% Mixer_Out = ones(1,3);
% Buff_Delayline = ones(1,3);
% fixed = ones(1,10);
%
% Input_Sig = [0.0642,0.2251,0.4274,0.6430,0.8349,0.9696,1.0089,0.9076,0.6788,0.3610,0.0047,-0.3400,-0.6385,-0.8867];
% HF_DEN = [1.0000, -1.0275, 0.7265];
% HF_NUM = [0.1367, 0.5, -0.1367];
%
% % pass 2 - using the quantize objects to convert to Q2.14 format
% input = quantize(a,Input_Sig);
% hf_den = quantize(b,HF_DEN);
% hf_num = quantize(c,HF_NUM);
% mixerout = quantize(d,Mixer_Out);
% buffdelayline = quantize(e,Buff_Delayline);
%
% % pass 1 - levelization has been done inside the for loop
% % scalarization hadn't been required. the code was already in that format
% 'fixed'
% for(counter=1:1:10)
% Mixer_Out(3) = Mixer_Out(2);
% Mixer_Out(2) = Mixer_Out(1);
% Mixer_Out(1) = Input_Sig(counter);
% Buff_Delayline(3) = Buff_Delayline(2);
% Buff_Delayline(2) = Buff_Delayline(1);
%
% temp1 = quantize(f,Mixer_Out(3)*HF_NUM(3));
% temp2 = quantize(g,Mixer_Out(2)*HF_NUM(2));
% temp3 = quantize(h,temp1 + temp2);
% temp4 = quantize(i,Mixer_Out(1)*HF_NUM(1));
% temp5 = quantize(j,temp3 + temp4);
% temp6 = quantize(k,Buff_Delayline(2)*HF_DEN(2));
% temp7 = quantize(l,temp5 - temp6);
% temp8 = quantize(m,Buff_Delayline(3)*HF_DEN(3));
% Buff_Delayline(1) = quantize(n,temp7 - temp8);
% fixed(counter) = Buff_Delayline(1);
% end
% fixed
% end
%
% function ques1_fixed;
%
% % pass2 - creating quantizer objects
% a=quantizer('fixed','round','saturate',[16 14]);
% b=quantizer('fixed','round','saturate',[16 14]);
% c=quantizer('fixed','round','saturate',[16 14]);
% d=quantizer('fixed','round','saturate',[16 14]);
% e=quantizer('fixed','round','saturate',[16 14]);
% f=quantizer('fixed','round','saturate',[16 14]);
% g=quantizer('fixed','round','saturate',[16 14]);
% h=quantizer('fixed','round','saturate',[16 14]);
% i=quantizer('fixed','round','saturate',[16 14]);
% j=quantizer('fixed','round','saturate',[16 14]);
% k=quantizer('fixed','round','saturate',[16 14]);
% l=quantizer('fixed','round','saturate',[16 14]);
% m=quantizer('fixed','round','saturate',[16 14]);
% n=quantizer('fixed','round','saturate',[16 14]);
%
% Mixer_Out = ones(1,3);
% Buff_Delayline = ones(1,3);
% fixed = ones(1,10);
%
% Input_Sig = [0.0642,0.2251,0.4274,0.6430,0.8349,0.9696,1.0089,0.9076,0.6788,0.3610,0.0047,-0.3400,-0.6385,-0.8867];
% HF_DEN = [1.0000, -1.0275, 0.7265];
% HF_NUM = [0.1367, 0.5, -0.1367];
%
% % pass 2 - using the quantize objects to convert to Q2.14 format
% input = quantize(a,Input_Sig);
% hf_den = quantize(b,HF_DEN);
% hf_num = quantize(c,HF_NUM);
% mixerout = quantize(d,Mixer_Out);
% buffdelayline = quantize(e,Buff_Delayline);
%
% % pass 1 - levelization has been done inside the for loop
% % scalarization hadn't been required. the code was already in that format
% 'fixed'
% for(counter=1:1:10)
% Mixer_Out(3) = Mixer_Out(2);
% Mixer_Out(2) = Mixer_Out(1);
% Mixer_Out(1) = Input_Sig(counter);
% Buff_Delayline(3) = Buff_Delayline(2);
% Buff_Delayline(2) = Buff_Delayline(1);
%
% temp1 = quantize(f,Mixer_Out(3)*HF_NUM(3));
% temp2 = quantize(g,Mixer_Out(2)*HF_NUM(2));
% temp3 = quantize(h,temp1 + temp2);
% temp4 = quantize(i,Mixer_Out(1)*HF_NUM(1));
% temp5 = quantize(j,temp3 + temp4);
% temp6 = quantize(k,Buff_Delayline(2)*HF_DEN(2));
% temp7 = quantize(l,temp5 - temp6);
% temp8 = quantize(m,Buff_Delayline(3)*HF_DEN(3));
% Buff_Delayline(1) = quantize(n,temp7 - temp8);
% fixed(counter) = Buff_Delayline(1);
% end
% fixed
% end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -