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

📄 mtd8_2d.m

📁 MTD定点浮点仿真
💻 M
字号:
clear;
clc;
close all;
%低通滤波器系数
%参数:旁瓣——52dB   主瓣3dB点——0.17*pi  滤波器点数:8
lpf0=[8.793587100836e-014,3.38634123579e-013,7.112208030605e-013,1e-012,...
              1e-012,7.112208030605e-013,3.38634123579e-013,8.793587100836e-014];
%滤波器点数
N=8;
%主瓣3dB点
delta_w3db=0.17*pi;
%凹口宽度
w1=0.3;
FL=w1*(2*pi)+delta_w3db;%matlab设计修正
FH=(2*pi)-FL;
F_center= linspace(FL,FH,N);
n_omiga=(0:N-1)'*ones(1,N)*diag(F_center);
F_shift=exp(j*n_omiga);
fiter_f=lpf0'*ones(1,N).*F_shift;
fiter_r=abs(real(fiter_f));
fiter_i=abs(imag(fiter_f));
fiter_m=max(max(max(fiter_r)),max(max(fiter_i)));
fiter_f=round(fiter_f/fiter_m*(2^15-1));
fvtool(fiter_f(:,1),1,fiter_f(:,2),1,fiter_f(:,3),1,fiter_f(:,4),1,fiter_f(:,5),1,fiter_f(:,6),1,fiter_f(:,7),1,fiter_f(:,8),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));
f_points1=f_points(:,1:8);
f_points2=f_points(:,9:16);
outiq1=f_points1*fiter_f;
outiq2=f_points2*fiter_f;
y1=abs(outiq1);
y2=abs(outiq2);
y_max1=round(max(max(y1)));
y_max2=round(max(max(y2)));
y_max=round(max(y_max1,y_max2));
y_bin=dec2base(y_max,2)
y_bin_size=size(y_bin)
y1=y1/y_max;
y2=y2/y_max;
y1=20*log10(y1+eps);
y2=20*log10(y2+eps);
plot(f_point/pi,y1, 'DisplayName', 'y'); 
hold on
plot(f_point/pi,y2, 'DisplayName', 'y'); 
axis([0,2,-100,2])

⌨️ 快捷键说明

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