File:Multirate upsampling (interpolation) filter.svg
Summary
Description |
English: Depiction of one dot product, resulting in one output sample (in green), computed by a multirate filter. This illustrates the formula 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 | |||
Permission (Reusing this file) |
I, the copyright holder of this work, hereby publish it under the following license:
|
|||
SVG development | ||||
Gnu Octave source | click to expand
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");
|
Category:CC-Zero
Category:Created with GNU Octave
Category:Digital signal processing
Category:Images with Gnuplot source code
Category:Images with Octave source code
Category:Invalid SVG created with LibreOffice
Category:Pages using deprecated source tags
Category:SVG images with embedded raster graphics
Category:Self-published work