Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

5.3.1 vsip_vcreate_blackman_p - Create a Blackman Window Vector

vsip_vview_f* vsip_vcreate_blackman_f(vsip_length n, vsip_memory_hint hint);
Description

This function creates and initializes a vector with coefficients of a Blackman window of length n. The Blackman window is defined by the formula:

                (    )        (    )
w[k]=0.42-0.5cos 2πk- +0.08cos 4πk- , 0 ≤k <n
                 n-1           n-1
Parameters
Return Value
Example

vsip_vview_f *blackman_window; 
vsip_length i, n = 64; 
 
// Create a Blackman window of length 64 
blackman_window = vsip_vcreate_blackman_f(n, VSIP_MEM_NONE); 
 
if (blackman_window == NULL) { 
    // Handle error 
} 
 
// Print the first 10 coefficients 
printf("First 10 Blackman window coefficients:\n"); 
for (i = 0; i < 10; i++) { 
    printf("%2ld: %f\n", i, vsip_vget_f(blackman_window, i)); 
} 
 
// Use the window in a signal processing application 
// For example, apply it to a signal vector 
vsip_vview_f *signal = vsip_vcreate_f(n, VSIP_MEM_NONE); 
vsip_vview_f *windowed_signal = vsip_vcreate_f(n, VSIP_MEM_NONE); 
 
// Initialize signal with some values... 
// vsip_vfill_f(signal, 1.0f);  // Example: constant signal 
 
// Apply the window: windowed_signal = signal * blackman_window 
vsip_vmul_f(signal, blackman_window, windowed_signal); 
 
// Clean up 
vsip_valldestroy_f(blackman_window); 
vsip_valldestroy_f(signal); 
vsip_valldestroy_f(windowed_signal);
Notes