필터 지우기
필터 지우기

how to write the instruction to declare the "plus minus" 1V?

조회 수: 2 (최근 30일)
lotus
lotus 2013년 4월 13일
The sample-and-hold and the residue generators are used in a 100Ms/s, 10-bit pipeline converter with a "plus minus" 1V reference made by 9stages with 1.5-bit per stage and a final 1-bit stage.
Below is the code that i took from SD toolbox and how i declare the Vref. hope someone can tell me the correct way to do it.
function [snrdB,ptotdB,psigdB,pnoisedB] = calcSNR(vout,f,fB,w,N,Vref)
% SNR calculation in the time domain (P. Malcovati, S. Brigati)
% vout: Sigma-Delta bit-stream taken at the modulator output
% f: Normalized signal frequency (fs -> 1)
% fB: Base-band frequency bins
% w: windowing vector
% N: samples number
% Vref: feedback reference voltage
%
% snrdB: SNR in dB
% ptotdB: Bit-stream power spectral density (vector)
% psigdB: Extracted signal power spectral density (vector)
% pnoisedB: Noise power spectral density (vector)
%
Vref=-1|1
fB=ceil(fB);
signal=(N/sum(w))*sinusx(vout(1:N).*w,f,N); % Extracts sinusoidal signal
noise=vout(1:N)-signal; % Extracts noise components
stot=((abs(fft((vout(1:N).*w)'))).^2); % Bit-stream PSD
ssignal=(abs(fft((signal(1:N).*w)'))).^2; % Signal PSD
snoise=(abs(fft((noise(1:N).*w)'))).^2; % Noise PSD
pwsignal=sum(ssignal(1:fB)); % Signal power
pwnoise=sum(snoise(1:fB)); % Noise power
snr=pwsignal/pwnoise;
snrdB=dbp(snr);
norm=sum(stot)/Vref^2; % PSD normalization
if nargout > 1
ptot=stot/norm;
ptotdB=dbp(ptot);
end
if nargout > 2
psig=ssignal/norm;
psigdB=dbp(psig);
end
if nargout > 3
pnoise=snoise/norm;
pnoisedB=dbp(pnoise);
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by