helps for understanding how to implement "sinusx" function in the calcSNR.m file
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello,
I am taking a course on data converters. our textbook is data converter by malloberti. in the chapter 3, example code 3.2 , there is a function named calcSNR.m which contains a function "sinusx" which has not been defined. Can you help me to understand how to implement sinusx?
here it is calcSNR.m :
function [snrdB,ptotdB,psigdB,pnoisedB] = calcSNR(vout,f,fB,w,N)
% SNR calculation in the time domain (P. Malcovati, S. Brigati)
% function [snrdB,ptotdB,psigdB,pnoisedB] = calcSNR(vout,f,fB,w,N)
% 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
%
% snrdB: SNR in dB
% ptotdB: Bit-stream power spectral density (vector)
% psigdB: Extracted signal power spectral density (vector)
% pnoisedB: Noise power spectral density (vector)
%
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)/sum(vout(1:N).^2)*N; % 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
답변 (1개)
Walter Roberson
2023년 5월 12일
https://www.edaboard.com/threads/sigma-delta-calculation-of-snr.297827/
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!