Sunday, May 23, 2010

DSP style z^-n in Mathematica

To change a polynomial expression in z-domain from z^n to z^-n, modify the global variable $PrePrint:
$PrePrint = # /. {Power[z, n_] -> DisplayForm[SuperscriptBox[z, n]]} &;

Example usage: Linear model of the 2nd order delta-sigma modulator in z^-n form

Friday, May 14, 2010

Calculating the SNR of a bandpass delta-sigma modulator in Matlab

% This calculates the SNR of a bandpass delta-sigma modulator
% Alper Ucar, ucar {at} ieee {dot} org
% -------------------------------------------------------
% [snrv,PxtdB,PxnbdB] = snr(data,tone,fftlen,osr,offset)
% data: output stream in time-domain
% tone: input stream in time-domain
% fftlen: FFT length
% osr: oversampling ratio
% offset: number of samples to be removed from both sides
% of the spectral content for the measurement
% PxtdB: input power
% PxnbdB: noise power
% snrv: SNR
function[snrv,PxtdB,PxnbdB] = snr(data,tone,fftlen,osr,offset)