在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 6309|回复: 8

[求助] matlab仿真SAR ADC时的INL,DNL

[复制链接]
发表于 2015-10-29 16:04:11 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
为什么matlab仿真时,得出的理想ADC也会有INL、DNL,下图是仿真100次的结果,感觉好奇怪啊,是我的算法错了导致这奇怪的结果吗?请大神们指导

INL&DNL

INL&DNL

我的理解是,仿真时如果是理想的SAR ADC,是不是INL和DNL都应该是0呢?还是跟算法有关?
 楼主| 发表于 2015-10-29 16:18:21 | 显示全部楼层

一次仿真的全部INL&DNL值

一次仿真的全部INL&DNL值


   这是一次仿真的4096个点的结果,看上去也很奇怪,没经验,仿出来的结果都不能明白问题出在哪儿
发表于 2015-10-29 17:47:05 | 显示全部楼层
你用的算法都没给出来,我们怎么给意见?
发表于 2015-10-29 20:01:51 | 显示全部楼层
SAR的代码怎么实现的?光结果,没办法帮你啊。
 楼主| 发表于 2015-10-30 09:37:32 | 显示全部楼层
回复 3#&4#


   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%               successive approximation converter                 %
%            with finite DAC's slew-rate and bandwidth.            %
%           Case of binary weighted resistive array DAC            %
%       code by Fabrizio Conso, university of pavia, student       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function counter=kelvin(input,nbit,f_bw,sr,f_s,v)
% input = input sample
% nbit  = bits of the converter
% f_bw  = DAC bandwidth [f_s]
% sr    = DAC slew-rate [V_fs/T_s]
% f_s   = normalized sampling frequency
% v     = thresholds array


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                global variables                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                 %
%threshold_id=v(12);   %initializing ideal threshold to 0.5
threshold_id=v(nbit);
counter=0;
in=input;
threshold(1)=0.5;
tau=1/(2*pi*f_bw); %DAC的时间
Tmax=1/(f_s*nbit); %完成一次比较所需的最少时间
%                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


for k=1:nbit


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%            skip of last subtraction            
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                 %


    if k < 3
     %if k<6
        Tmax=2*Tmax;                           
    end


    if k==nbit
       if (in-threshold_id) > 0
           bit=1;
       else
           bit=0;
       end
%                                                 %        
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                  finite  bandwidth & slew-rate                   %   
%                       error calculation                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                  %
   else
   deltaV=abs(threshold_id-threshold(k));
   slope=deltaV/tau;
   if slope > sr
        tslew=(deltaV/sr) - tau;
            if tslew >= Tmax              % only slewing  
                error = deltaV - sr*Tmax;
            else
                texp = Tmax - tslew;                       
                error = (deltaV-sr*tslew)*exp(-texp/tau);
            end


   else
                % only exponential settling  

    texp = Tmax;

    error = deltaV*exp(-texp/tau);
   end        
   %threshold(k+1)=threshold_id-sign(threshold_id-threshold(k))*error;
   threshold(k+1)=threshold_id-sign(threshold(k)-threshold_id)*error;
%                                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%      successive approximation       %
%        conversion algorythm         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                     %
      %if (in-threshold(k+1)) > 0
      if (in-threshold(k+1)) > 0
          threshold_id=threshold_id+v(nbit-k);
          %threshold_id=threshold_id+v(nbit-k);
          bit=1;
      else
          threshold_id=threshold_id-v(nbit-k);
          %threshold_id=threshold_id-v(nbit-k);
          bit=0;
      end
    end


     Tmax=1/(f_s*nbit);
counter=(counter+bit*2^(nbit-k));
  %counter=(counter+bit*0.5^(nbit-k+1));
end
%                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%             Output             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                %
counter=counter;
%                                %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




sorry 我忘记把代码贴上来了=。=大神们再看看~
 楼主| 发表于 2015-11-2 09:57:22 | 显示全部楼层
理想的SARADC的INL和DNL是不是应该为0呢?
 楼主| 发表于 2015-11-18 13:38:54 | 显示全部楼层
自己顶一个
发表于 2016-8-11 18:30:22 | 显示全部楼层
matlab仿真SAR ADC时的INL,DNL
发表于 2017-12-7 14:01:48 | 显示全部楼层
matlab仿真SAR ADC时的INL,DNL
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 02:23 , Processed in 0.036473 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表