⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtd16_2d.m

📁 MTD定点浮点仿真
💻 M
字号:
clear;
clc;
close all;
%低通滤波器系数
%参数:旁瓣——72dB   主瓣3dB点——0.1*pi  滤波器点数:16
lpf0=[  1.123464047307e-012,4.845415798595e-012,1.320458112037e-011,2.751456987263e-011,...
  4.722492095763e-011,6.927445201897e-011,8.862914772361e-011,            1e-010,...
              1e-010,8.862914772361e-011,6.927445201897e-011,4.722492095763e-011,...
  2.751456987263e-011,1.320458112037e-011,4.845415798595e-012,1.123464047307e-012];
%滤波器点数
N=16;
%主瓣3dB点
delta_w3db=0.1*pi;
%凹口宽度
w1=0.3;
FL=w1*(2*pi)+delta_w3db;%matlab设计修正
FH=(2*pi)-FL;
F_center= linspace(FL,FH,16);
n_omiga=(0:N-1)'*ones(1,16)*diag(F_center);
F_shift=exp(j*n_omiga);
fiter16_f=lpf0'*ones(1,16).*F_shift;
fiter_r=abs(real(fiter16_f));
fiter_i=abs(imag(fiter16_f));
fiter_m=max(max(max(fiter_r)),max(max(fiter_i)));
fiter16_f=round(fiter16_f/fiter_m*(2^15-1));
fvtool(fiter16_f(:,1),1,fiter16_f(:,2),1,fiter16_f(:,3),1,fiter16_f(:,4),1,fiter16_f(:,5),1,fiter16_f(:,6),1,fiter16_f(:,7),1,fiter16_f(:,8),1,...
    fiter16_f(:,9),1,fiter16_f(:,10),1,fiter16_f(:,11),1,fiter16_f(:,12),1,fiter16_f(:,13),1,fiter16_f(:,14),1,fiter16_f(:,15),1,fiter16_f(:,16),1);

N_point=256;
inval=2*pi/N_point;
f_point= linspace(0,2*pi-inval,256);
nomiga=(0:15)'*ones(1,256)*diag(f_point);
f_points=exp(j*nomiga);
f_r=abs(real(f_points));
f_i=abs(imag(f_points));
f_m=max(max(max(f_r)),max(max(f_i)));
f_points=round(f_points/f_m*(2^15-1));
f_points=conj(f_points');
% f_r=abs(real(f_points));
% f_i=abs(imag(f_points));

outiq=f_points*fiter16_f;
y=abs(outiq);

y_max=round(max(max(y)));
y_bin=dec2base(y_max,2)
y_bin_size=size(y_bin)
y=y/y_max;
y=20*log10(y+eps);
plot(f_point/pi,y, 'DisplayName', 'y'); 
axis([0,2,-100,2])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -