ADC靜態效能指標計算程序

2023-01-21 11:24:06 字數 3105 閱讀 9154

%"adc_static" -produced by jerome cool, 12.27.2009

%adc靜態特性測試,包含dnl,inl,offset,missing code

%進行測量時施加訊號為單音正弦訊號,幅度應略微超過滿幅,保證所有碼均能出現

%注意!目前版本僅能處理普通二進位制編碼結果。

clear all;

close all;

clc;

%--請使用者根據實際情況修改以下部分--

need_preprocess=1; %need_preprocess=1表示資料格式預處理,將示波器原始輸出檔案轉化為規範的csv檔案格式

resolution=8; %adc設計位元數

fs=20e6; %adc取樣頻率

filepath=''; %示波器產生的原始csv檔案所在路徑

filehead='h'; %示波器產生的原始csv檔名統一字首

filebegin=1;

fileend=20;

%example

% filehead='hits'; %示波器產生的原始csv檔名統一字首

% filebegin=1;

% fileend=10;

% 則檔名為"","",...,""

%資料格式預處理,將示波器原始輸出檔案轉化為規範的csv檔案格式

if (need_preprocess==1)

for indexf=filebegin:fileend

datapre=csvread(strcat(filepath,filehead,num2str(indexf),'.csv'),1,0); %讀入原始csv檔案內容

rowpre=size(datapre);

rowpre=rowpre(1);

rowpost=floor(sum(datapre(:,2))*fs)

datapost=zeros(rowpost,2);

t=1/fs;

indexpre=1;

indexpost=0;

index=0;

for indexpre=1:rowpre

delta=datapre(indexpre,2);

delta=round(delta/t);

if delta>0

for index=1:delta

datapost(index+indexpost,1)=(index+indexpost)*t;

datapost(index+indexpost,2)=datapre(indexpre,3);

endindexpost=indexpost+delta;

endendcsvwrite(strcat('post_hits',num2str(indexf),'.csv'),datapost); %將轉換後的資料寫入csv檔案,預處理後輸出檔名統一為"post_","post_",...

clear t datapost datapre delta index indexpost indexpre rowpost rowpre;

close all;

enddisp('pre process done.');

end%資料格式預處理,將示波器原始輸出檔案轉化為規範的csv檔案格式

%直方圖統計

clear filehead fs indexf;

clc;

h=zeros(2^resolution,1);

disp('reading data file(s)...');

for index=filebegin:fileend

dataorg=csvread(strcat(filepath,'/post_hits',num2str(index),'.csv'),0,0); %讀入原始csv檔案內容

len=size(dataorg);

len=len(1);

for cnt=1:len

code=dataorg(cnt,2)+1;

h(code)=h(code)+1;

endenddisp('finished data file(s).');

%靜態特性指標計算

ch=cumsum(h);

v=-cos(pi*ch/sum(h));

trunc=1;

lsb=(v(end-trunc)-v(1))/(2^resolution-2*trunc);

offset=mean(v(1+trunc:end-trunc))/lsb;

hlin=v(1:end)-[0;v(1:end-1)];

hlin_trunc=hlin(1+trunc:end-trunc);

dnl=(hlin_trunc./lsb)-1;

inl=[0;cumsum(dnl)];

%靜態特性指標結果顯示

disp(strcat('input offset =',char(20),num2str(offset),' lsb'));

disp(strcat('min_dnl =',char(20),num2str(min(dnl)),' lsb, max_dnl =',char(20),num2str(max(dnl)),' lsb'));

disp(strcat('min_inl =',char(20),num2str(min(inl)),' lsb, max_inl =',char(20),num2str(max(inl)),' lsb'));

missing_code=find(dnl<-0.9)'

figure;

plot(dnl,'r');

grid on;

title('dnl plot');

xlabel('code');

ylabel('dnl (lsb)');

axis([0 2^resolution-1 min(dnl) max(dnl)]);

figure;

plot(inl);

grid on;

title('inl plot');

xlabel('code');

ylabel('inl (lsb)');

axis([0 2^resolution-1 min(inl) max(inl)]);

clear all;

泥漿效能指標試驗

一 泥漿比重試驗 1 試驗儀器 泥漿比重計 2 試驗方法 將要測定的泥漿裝滿泥漿杯,加蓋並洗淨從小孔溢位的泥漿,再置於支架上,移動遊碼,使槓桿水平,讀出遊碼左側的刻度即為泥漿的相對密度。圖 1為國內常用nb 1型泥漿比重計 nb 1型泥漿比重計 nb 1型泥漿比重計是乙個不等臂的天平,它的槓桿刀口擱...

AGC效能指標計算及補償考核度量辦法

一 agc機組調節過程 如下圖所示,這是網內某台機組一次典型的agc機組設點控制過程。圖中,是該機組可調的下限出力,是其可調的上限出力,是其額定出力,是其啟停磨臨界點功率。整個過程可以這樣描述 t0時刻以前,t1時刻以前,該機組穩定執行在出力值p1附近,t0時刻,agc控制程式對該機組下發功率為p2...

外保溫系統相關材料效能指標

模塑板 擠塑板 允許偏差 模塑板外保溫系統效能指標 塗料飾面 模塑板外保溫系統效能指標 面磚飾面 擠塑板外保溫系統效能指標 塗料飾面 擠塑板外保溫系統效能指標 面磚飾面 硬泡聚氨酯板尺寸允許偏差 硬泡聚氨酯外牆外保溫系統效能指標 保溫板效能指標 膠粘劑效能指標 注 與擠塑板的拉伸粘接強度為擠塑板塗刷...