LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replicating Scaled Time Domain Window (Hamming) and Auto Spectrum VI in MATLAB

Hi! I’m working on replicating some LabVIEW signal processing steps in MATLAB and had a question. Specifically, I’d like to understand the detailed implementation of the Scaled Time Domain Window VI (with Hamming) and the Auto Spectrum VI.

I know LabVIEW has built-in functions for FFT/PSD, but since the underlying code isn’t visible, I want to make sure I can match the results as closely as possible in MATLAB. Does anyone know where I can find documentation or a breakdown of the exact algorithms/constants used in these VIs, or has anyone already translated them into MATLAB before? Thank you in advance! 

0 Kudos
Message 1 of 2
(169 Views)

Hi wji4,

 

Scaled Time Domain Window VI (Hamming)

This VI applies a window (like Hamming), scales it using the Coherent Gain, and calculates the Equivalent Noise Bandwidth (ENBW). You can find some documentation here: Scaled Time Domain Window VI

 

In MATLAB, you can replicate it like this:

 

w = hamming(N);

CG = sum(w)/N;

x_windowed = x .* w / CG;

ENBW = N * sum(w.^2) / (sum(w)^2);

 

Auto Spectrum VI

This VI computes the single-sided power spectral density (PSD) using FFT, scaled by sampling rate and signal length. You can find some documentation here: Auto Power Spectrum VI

MATLAB version:

 

xdft = fft(x_windowed);

xdft = xdft(1:N/2+1);

psdx = (1/(fs*N)) * abs(xdft).^2;

psdx(2:end-1) = 2*psdx(2:end-1);

 

 

If you're looking for how LabVIEW implements FFT and PSD internally, these docs go into detail:

 

Also, this Solved: Difference between LabVIEW FFT and Matlab FFT - NI Community discusses how others have done this in MATLAB — might be useful!

Message 2 of 2
(85 Views)