File:Multirate upsampling (interpolation) filter.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 900 × 630 pixels, file size: 43 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Depiction of one dot product, resulting in one output sample (in green), computed by a multirate filter. This illustrates the formula y[j+nL]=∑k=0Kx[n−k]⋅h[j+kL],  j=0,1,…,L−1, at Upsampling by an integer factor, for the case L=4, n=9, j=3. Three (L-1) conceptual "inserted zeros" are depicted between each pair of input samples. Omitting them from the calculation is what distinguishes a multirate filter from a monorate filter.
    Date
    Source Own work
    Author Bob K
    SVG development
    InfoField
     The source code of this SVG is invalid due to 2 errors.
    V
     This W3C-invalid vector image was created with GNU Octave.

    Source code

    The logo of GNU Octave – numerical computation software
    The logo of GNU Octave – numerical computation software
    This media was created with GNU Octave (numerical computation software)
    Here is a listing of the source used to create this file.

    Deutsch ∙ македонски ∙ English ∙ +/−

    This graphic was created with the help of the following Octave script:

    pkg load signal
    graphics_toolkit gnuplot
     M = 1000;
     darkgreen = [33 150 33]/256;
     interpolation_factor = 4;
    
    % Generate M+1 samples of a Gaussian window (filter type not important)
     filter = .3*exp(-.5*(((0:M)-M/2)/(.4*M/2)).^2);
    % Sample the window.
     N=24;
     sam_per_hop = M/N;
     window_dots = filter(1+(0:N)*sam_per_hop);
     normalize   = sum(window_dots)/interpolation_factor;
    
     window_scale_factor = 0.5;
     sam_per_hop = sam_per_hop*window_scale_factor;
     
    %------------------------------------------------------------------
     figure("position", [100 200 900 600])
    
    % Plot the continuous filter function
     xoffset = sam_per_hop*15;
     yoffset = 0.1;
     
     plot(xoffset+(0:M)*window_scale_factor, yoffset+filter,  "linestyle",":", "linewidth",1, "color","black")
     set(gca, "xaxislocation", "origin")
     xlim([0 M])
     ylim([-.06 .45])                    % allows space for negative samples (in case I change the signal)
     set(gca, "ygrid","off");
     set(gca, "xgrid","on");
     set(gca, "ytick",[0], "fontsize",14);
     xticks = [0:4*sam_per_hop:M];
     set(gca, "xtick",xticks)
     set(gca,"xticklabel",[0:length(xticks)])
    
    % Plot the filter coefficients
     hold on
     plot(xoffset+(0:N)*sam_per_hop, yoffset+window_dots,  "color","red", ".", "markersize",10)
    
    % Create signal to be interpolated
     samples_per_cycle = 4*M;
     signal = .2*sin(2*pi*(0:M)/samples_per_cycle);
    
     signal_dots = signal(1:sam_per_hop:end);
    % Simulate "inserted zeros", for display
     signal_dots(2:4:end) = 0;
     signal_dots(3:4:end) = 0;
     signal_dots(4:4:end) = 0;
    
    % Plot the data
     L = length(signal_dots);
     plot((0:L-1)*sam_per_hop, signal_dots,  "color","blue", ".", "markersize",10)
     
    % Compute dot product, and plot it
     dot_product = sum(window_dots(24:-4:4).*signal_dots(17:4:37))/normalize;
     x = 27*sam_per_hop;
     plot(x, dot_product, "color",darkgreen, ".", "markersize",14)
     plot([x,x],[0,.45]);                                   % vertical line
     
    % xlabel('\leftarrow  n  \rightarrow', "fontsize",16)
     text(465, -.05, '\leftarrow  n  \rightarrow', "fontsize",16)
     text(18, .1, "X[n]", "fontsize",16, "color","blue")
    
     title("Multirate interpolation filter", "fontsize",16, "fontweight","normal");
    

    Licensing

    Bob K, the copyright holder of this work, hereby publishes it under the following license:
    Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
    The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    21 December 2019

    image/svg+xml

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current14:44, 24 December 2019Thumbnail for version as of 14:44, 24 December 2019900 × 630 (43 KB)wikimediacommons>Bob Kadd a vertical line for filter delay arrow to point at

    There are no pages that use this file.