|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
最近在测试10bitSAR ADC的INL和DNL,芯片输入是正弦波,用的是EE247给的码密度matlab程序,但是程序中有一句T = -cos(pi*ch/sum(h));不太理解,望大神能指点一下。附:
datap=textread('4_1.txt','%s');
datan=textread('4_2.txt','%s');
datap=hex2dec(datap);
datan=hex2dec(datan);
y=datap-datan;
minbin=min(y);
maxbin=max(y);
% histogram
a=hist(y, minbin:maxbin);
h=a(1:2:end);
%h=h(2:end-1);
% cumulative histogram
ch = cumsum(h);
% transition levels found by:
T = -cos(pi*ch/sum(h));
% linearized histogram
hlin = T(2:end) - T(1:end-1);
% truncate at least first and last
% bin, more if input did not clip ADC
trunc=2;
hlin_trunc = hlin(1+trunc:end-trunc);
% calculate lsb size and dnl
lsb= sum(hlin_trunc) / (length(hlin_trunc));
dnl= [0 hlin_trunc/lsb-1];
misscodes = length(find(dnl<-0.99));
% calculate inl
inl= cumsum(dnl); |
|