Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts

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)

Wednesday, April 21, 2010

Coherent Sampling Calculator

% Coherent sampling calculator for ADC testing
% Signal generator resolution in decimal places after MHz is
% considered to be 6 -- i.e. Resolution is 1 Hz
% See http://www.maxim-ic.com/app-notes/index.mvp/id/3190
% for details --Alper Ucar, ucar {at} ieee {dot} org
% Finc: coherent input frequency of the test signal
% Fs: coherent sampling rate
% Fs: sampling rate
% Fin: input frequency of the test signal
% N: number of samples
function[Fsc,Finc] = csr(Fs,Fin,N)

Tuesday, April 20, 2010

Plotting an Accurate PSD Estimate in MATLAB

% This script plots the power spectral density estimate
% of a signal --Alper Ucar, ucar {at} ieee {dot} org
% data: output stream in time-domain
% fftlen: FFT length
% Fs: sampling rate
% pxf: mean-square power of the signal
function[pxf] = pspec(data,fftlen,Fs)