4.66667

4.7 | 3 ratings Rate this file 32 Downloads (last 30 days) File Size: 5.45 KB File ID: #41236
image thumbnail

sine wave spectrum analysis function

by

 

get signal frequency, amplitude, offset voltage, SNR, THD, SND, ENOB of simulation or test output

| Watch this File

File Information
Description

% [fsig,amp,vos,snr,thd,sndr,enob,phi]=fft_hann(data, bw_low, bw_high, fs, fig, tit, opt);
% [fsig,amp,vos,snr,thd,sndr,enob,phi]=fft_hann(data, 20, 20e3, 65536, '', 'No title', opt);
% opt=fft_hann(); % return default option.
% fsig: signal frequency
% amp: sig amplitude
% vos: offset voltage
% thd: total harmonic distortion
% sndr: signal to noise and distortion ratio
% enob: efficient number of bits
% phi: signal phase
% data: data to be fft
% bw_low: lowband of inband frequency
% bw_high: highband of inband frequency
% fs : sampling rate
% fig = combination if 'i','f','w','I','F','W', stands for inband fig,
% fullband fig, wave fig, Upper case will generate tit.png file
% tit: title of figure.
% opt: additional options:
% opt.nhd: number of harmonic distortion force to caculate
% opt.nspur: number of spur to caculate
% opt.RL: RL to caculate power;
% opt.win = 'barthannwin','bartlett','blackman','blackmanharris','bohmanwin',
% 'chebwin', 'flattopwin', 'gausswin', 'hamming', 'hann', 'kaiser',
% 'nuttallwin', 'parzenwin', 'rectwin', 'taylorwin', 'triang', 'tukeywin',
% opt.coherent: coherent sampling, minimize skirt
% opt.sig_leakage: when coherent sampling, still caculate as much as possible skirt
% opt.sig_add_span: when coherent sampling, add additional skirt to besides
% of window skirt, no effect when opt.sig_leakage = 1;
% Example:
% x = sin((1:65536)*2*pi*111/2048);
% x = x + 0.001*x.^2 + 0.002*x.^3 + 0.0001*sin([1:65536]*2*pi*31/2048);
% x = x + randn(size(x))*1e-5 + 0.01;
% fft_hann(x,200,20e3,65536,'fiw','title');
% opt=fft_hann();
% opt.coherent=1;
% fft_hann(x,0,20e3,65536,'i','title',opt);
% opt.win = 'rectwin';
% fft_hann(x,0,20e3,65536,'i','title',opt);
% opt.sig_leakage = 1;
% fft_hann(x,0,20e3,65536,'i','title',opt);
% opt.win = 'blackmanharris';
% fft_hann(x,0,20e3,65536,'i','title',opt);

MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
11 Sep 2013 Jules Antoine  
14 Aug 2013 Edwin

The software works fine and delivers the same results as our internal ENOB software. A little bit more documentation would be usefull

08 Jul 2013 Ashwini  

Contact us