Convolutional layer 2026-11-05
A convolutional layer applies shared local filters across an input grid to produce output neural network channels. Each filter combines the input channels and nearby positions, with the same learned weights reused at different output positions. This weight sharing distinguishes it from assigning unrelated weights to every grid location.[ref]
Deep Learning by Ian Goodfellow and others. Chapter 9, §9.2, sparse interactions and parameter sharing
For real-valued input , dense channel connectivity, no padding and convolution stride one, write the affine output asHere selects the output channel, an input channel, the filter weights and a neural network bias. The spatial indices stay in range. This unflipped-filter formula is the cross-correlation convention used by the Conv2d implementation, despite its convolution name. Mathematical discrete convolution reverses the kernel's displacement indices; state the convention when comparing formulas.[ref]
Conv2d in the PyTorch documentation. Opening equation, valid two-dimensional cross-correlation and channel summation
For one input channel, takeThe first patch gives . Applying the same weights everywhere givesA following rectified linear unit produces . The affine filter operation and the subsequent activation function are separate steps, although an architectural description sometimes groups them together.
For an input grid in this unpadded, unit-stride case, the output dimensions are . There are weights for each output channel and one bias, so the total parameter count isIt does not grow with or ; the number of filter applications does.[ref]
The neural network receptive field identifies which input positions can influence an output. Local filters restrict that dependency, while successive layers can combine information from a larger region. Convolution stride and zero padding alter the spatial sampling and boundary behavior; the explicit formulas above assume neither subsampling nor padding.
Convolution dilation 2026-11-05
Convolution dilation specifies the spacing between neighboring kernel sample points in a convolutional layer. Dilation one samples adjacent positions; larger dilation separates those positions while keeping the filter's learned coefficient count fixed. Convolution stride instead controls the spacing between successive filter origins.[ref]
Conv2d in the PyTorch documentation. Opening parameter descriptions; Parameters, dilation and stride
For an own real one-dimensional example, takeand coefficients , with stride one, no padding and no bias. Use the unflipped cross-correlation convention. Dilation one sums three adjacent values and gives . Dilation two instead uses offsets :The second filter evaluates a wider input span while still using three coefficients.
For sampled coefficients separated by positions, the first-to-last displacement is . Including the first position gives the effective convolution kernel sizeThus spans five positions. At each origin only three of those five positions are sampled directly.
The same linear operation can be represented by a dense width-five kernel . The inserted zeros are fixed structure, not additional trainable coefficients. Dilation changes the footprint without making the original three-parameter filter a general five-parameter one.[ref]
Conv2d in the PyTorch documentation. Variables, weight shape depends on kernel dimensions and channel connectivity
For input length , symmetric zero padding and stride , the usual per-axis size formula becomeswhen the padded input accommodates the footprint. The example gives outputs. The floor function counts origins whose final sample remains in range.[ref]
Dilation can enlarge a unit's spatial neural network receptive field without evaluating every intervening input position. Whether later layers fill those gaps depends on the architecture. A wider span alone does not establish greater numerical influence at every position or better performance on a learning task.
Convolution stride 2026-11-05
The convolution stride specifies how far the filter's origin advances between neighboring output positions of a convolutional layer. It controls which spatial positions are evaluated. A larger stride usually produces a smaller output grid without changing the number of coefficients in each filter.[ref]
For a real one-dimensional example, take the inputand a size-three all-ones filter, no bias and no padding. Using the unflipped cross-correlation convention, stride one evaluates windows beginning at indices and givesStride two evaluates windows beginning at indices , givingThe second result keeps every second origin from this first grid; it still combines three input values for each retained origin.
For an undilated length- input and length- filter, no padding and stride , a zero-indexed output uses input indices through . Requiring its last index not to exceed gives . Counting the admissible nonnegative integers therefore giveswhen and is a positive integer. The floor function is essential when the last candidate origin would extend beyond the input.
With symmetric zero padding of positions per side and convolution dilation , the corresponding standard shape expression isHere dilation changes the spacing of samples within a filter footprint; stride changes the spacing between filter origins. The two parameters have different roles.[ref]
Conv2d in the PyTorch documentation. Parameters, stride/padding/dilation; Shape, each spatial-axis formula
For two-dimensional data, specify a stride for each spatial axis; unequal strides need not reduce height and width by the same amount. The weights of the filter remain shared across the visited positions. Stride also changes how neighboring outputs' neural network receptive fields are spaced in the original input, so it affects more than just a displayed array size.
Discrete convolution Created 2026-09-24 Updated 2026-10-14
For sequences indexed by the integers, discrete convolution adds products whose indices sum to the output index:For finite sequences, treat every unspecified entry as zero; the sum then has finitely many nonzero terms. For infinite sequences, a convergence hypothesis is needed, for example absolute summability of both sequences.
Take at indices and at indices . Their convolution is at indices :Equivalently, : add an unshifted and a one-step shifted copy of . This explains the output by superposition, with every index included.
Discrete convolution combines index pairs, shifted copies, polynomial coefficients and outcome counts
. Details. The same products appear in polynomial multiplication and generating functions:A term times contributes to coefficient , precisely the index condition in discrete convolution. In probability, counts the outcomes of two independent fair coin tosses by their number of heads, while counts the outcomes of one more toss. Dividing the output by eight gives the probability mass function of the binomial distribution with and . No new arithmetic is needed to pass from coefficient multiplication to counting independent sums.
The full finite convolution is different from circular convolution, where indices wrap modulo a chosen length. Wrapping this four-term output to length three adds its last entry to its first and gives . When using a discrete Fourier transform to compute the full convolution, zero padding to length at least the sum of the input lengths minus one prevents this wraparound. [ref]
https://ocw.mit.edu/courses/res-6-008-digital-signal-processing-spring-2011/610905d8154ec2bfc090cf78022249a5_MITRES_6_008S11_lec10.pdf. Oppenheim, MIT Digital Signal Processing, Lecture 10, circular convolution and zero padding
Discrete-time Fourier transform 2026-11-05
The discrete-time Fourier transform represents a sequence indexed by integer sample number using a continuous, periodic frequency variable. In cycles per sample, the transform pair isFor an absolutely summable sequence, the sum converges uniformly to a continuous function, and the inverse formula follows by integrating the exponentials term by term. Their integral over one frequency period is one when the integer exponent is zero and zero otherwise. The primary text gives the same pair in angular frequency , where the inverse integral carries a factor .[ref]
Because , . Discrete time therefore does not imply discrete frequency: the DTFT is defined at every frequency in one period. With sampling frequency , a physical frequency corresponds to ; frequencies separated by integer multiples of give identical sampled complex exponentials. This is the basic frequency ambiguity behind aliasing.
An original two-sample example takes and all other entries zero. ThenAt zero frequency its value is one; at its magnitude is with phase ; at it vanishes. As the impulse response of a two-tap moving average, it preserves a constant input and removes an alternating-sign input. SciPy’s frequency-response definition evaluates precisely such sums when its denominator is one; its frequency units depend on the fs parameter.[ref]
For a finite record extended by zero, the unnormalized discrete Fourier transform gives samples of the same continuous function:Zero padding the record to length instead evaluates on a denser grid. It does not change or restore unobserved time samples. The rectangular window and Hann window demonstrate how the selected finite record shapes that continuous response.
Convergence assumptions matter. For when , zero otherwise, and , the geometric sum givesAt , that ordinary convergent-sum argument fails. Square-summable sequences admit an interpretation, while perpetual tones require a generalized interpretation; neither should be treated as an absolutely convergent version of the same series without stating the interpretation.
A useful check of numerical transform conventions is to evaluate a finite sum at arbitrary frequencies, compare its DFT-grid values with the FFT output, and repeat after zero-padding. This tests the exponent sign, normalization and frequency units independently. In a physical acquisition, one must also state sampling rate, record duration and the response before sampling; dense numerical frequency points alone do not validate those experimental inputs.
Effective convolution kernel size 2026-11-05
The effective convolution kernel size is the bounding extent of a dilated convolution kernel along a spatial axis. For sampled coefficients with convolution dilation , their offsets are . The first-to-last displacement is , so including the first position givesThis extent determines the kernel footprint used in spatial shape calculations; it is not generally the number of coefficients.[ref]
For a two-dimensional example, choose a sampled kernel shape with dilation . Its row offsets are and column offsets are . The bounding shape is thereforeThere are six sampled spatial positions inside a twenty-position bounding box. Fourteen intermediate positions are absent from the sampling pattern.
With three input neural network channels and four output channels, ordinary dense channel connectivity usesweights and optionally four biases, giving parameters. A general dense five-by-four kernel with the same channel counts would have weights. Representing the dilated operation that way would require of them to be fixed zeros, rather than independently learned parameters.[ref]
For an unpadded -by- input and convolution stride one, the output grid isMore generally, for one axis with symmetric zero padding and stride ,when the padded input accommodates the footprint. The floor function counts admissible filter origins.[ref]
The effective size is a geometric quantity for one layer. The complete neural network receptive field through several layers additionally depends on their kernels, strides and connections. Likewise, changing stride moves the spacing of origins; changing dilation changes the footprint at each origin. Keeping bounding extent, sampled-position count and learned-parameter count separate avoids confusing three different sizes.
Equivalent noise bandwidth 2026-11-05
The equivalent noise bandwidth of a finite window is the width of an ideal rectangular frequency response that passes the same white-noise power when both responses have the same peak gain. It quantifies noise collected by a spectral amplitude estimate, rather than the separation needed to distinguish two tones. For real coefficients with nonzero sum and sampling frequency , is in hertz; is in bins of an -sample record. The primary software documentation gives as the exact conversion factor between its squared spectrum and power-spectral-density scalings.[ref]
An original variance derivation explains the formula. Let independent zero-mean sample noise have variance , and form the complex amplitude estimate at frequency ,Cross terms vanish by the independence and zero means, soThe flat two-sided input noise spectral density is . Integrating it over the peak-normalized window response gives the same result by Parseval identity. A one-sided real-signal convention folds negative-frequency power into positive frequencies; factors of two must be handled consistently, rather than changing the window’s bandwidth ratio.
For a rectangular window, and , giving . For the periodic Hann window with , the cosine sums give and , hence . These agree with the instrument manual’s tabulated values.[ref]
For an original numerical comparison, take and , so the original frequency grid spacing is . Rectangular and periodic Hann bandwidths are respectively and . With independent sample noise of standard deviation , the RMS magnitude of the zero-mean complex noise estimate is for rectangular weighting and about for Hann weighting. The latter variance is 1.5 times greater, despite Hann’s lower distant sidelobes. It is the RMS complex-error magnitude, not automatically the standard deviation of a positive spectral-magnitude display.
Zero padding leaves , the actual window coefficients and unchanged. If a 256-sample Hann record is padded to 1024 points, the display spacing becomes and the same bandwidth spans six displayed bins. Replacing by the padded FFT length in a formula while leaving the coefficient sum unchanged confuses these two bin units.
The noise covariance between windowed Fourier bins also matters when combining several spectral values: a taper can correlate neighboring estimates. Bandwidth alone does not specify their joint statistics, and colored noise requires weighting its actual spectral density. A proposed check repeats the same estimator on independent synthetic noise records with known variance, then on measured noise with a characterized acquisition response, comparing empirical mean squared complex error with the formula. Report window convention, detrending, one-sided/two-sided scaling and record duration so the test can be reproduced.
Half-bin amplitude response of a window 2026-11-05
The half-bin amplitude response of a window is the magnitude response to an isolated tone halfway between neighboring discrete Fourier transform frequencies, divided by the response to a bin-centered tone of the same amplitude. It quantifies a particular off-grid amplitude error after correcting the coherent gain of a window. For coefficients with nonzero sum, defineA loss convention reports in decibels. The primary instrument manual tabulates approximately for rectangular weighting and for Hanning weighting.[ref]
To derive the ratio, take a complex tone . Evaluating the windowed transform at bin gives . For real window coefficients, the responses at opposite offsets have equal magnitude. Dividing by removes the on-bin scaling and leaves . This calculation isolates the frequency-grid effect from noise and other spectral components.
For a rectangular window, summing the geometric series yieldsFor , the ratio is about . The large- value is about , explaining the familiar scalloping loss rather than an exact finite-record constant.
For the periodic Hann window, . Its finite response iswhere is the rectangular response and for . Substitution gives about at . A useful limiting derivation replaces the normalized sum by its integral:with continuous limiting values at . At its magnitude is . For a short periodic window, the coefficients instead give . The finite definition avoids treating the asymptotic value as exact.
The symmetric Hann window uses denominator , not ; it has a different finite response and coefficient sum. SciPy explicitly distinguishes the symmetric filter-design convention from the periodic spectral convention.[ref] The exact half-bin ratio should therefore use the coefficients actually applied.
For an original acquisition example, a -sample record at has bin spacing. A complex tone at lies halfway between bins 10 and 11. An amplitude-one tone gives a corrected nearest-bin magnitude about with rectangular weighting or with periodic Hann weighting. Zero padding changes the sampled grid of the same discrete-time Fourier transform; if the padded grid contains , its value there has no half-bin error relative to that tone.
The half-bin response is not automatically a universal worst-case bound for every conceivable window. Nor does the isolated-complex-tone calculation cover every real-sinusoid measurement: near zero frequency or the sampling limit, the mirrored spectral component can overlap and make the observed magnitude phase-dependent. A proposed test sweeps a constant-amplitude tone through a bin interval, varies phase for real signals, and compares the complete finite-sum response before quoting a single off-bin accuracy number.
Noise covariance between windowed Fourier bins describes the statistical dependence created when several spectral estimates use the same noisy record. A window changes not only each estimate’s equivalent noise bandwidth, but also the overlap of their frequency responses. Uncorrelated time samples therefore need not produce uncorrelated spectral bins after tapering.
Let independent zero-mean sample errors satisfy . Use real coefficients , nonzero sum , and coherent-amplitude-normalized estimates on the original -point grid,Expanding their complex covariance and removing the vanishing cross terms givesThus the covariance is the Fourier transform of the squared window, evaluated at the bin difference. Its diagonal agrees with the equivalent noise bandwidth variance formula. SciPy’s spectrum/density scaling likewise uses the coefficient-square sum separately from the squared coherent sum.[ref]
For a rectangular window, the exponential orthogonality sum gives on this unpadded grid. This is a statement about covariance; independence additionally follows for an appropriate Gaussian noise model, not for every possible input distribution.
For the periodic Hann window, with ,Its original-grid covariance has only five nonzero cyclic diagonals:with bin indices modulo . Normalizing by the common diagonal gives adjacent-bin covariance ratio and second-neighbor ratio . The negative sign follows from this window’s placement in the record; changing the time placement can change covariance phases without changing their magnitudes. The periodic and symmetric coefficient conventions must not be interchanged in this finite calculation.[ref]
SciPy 1.16.2 documentation. scipy.signal.windows.hann, sym parameter and defining raised-cosine coefficients
Noise covariance between windowed Fourier bins for rectangular and periodic Hann windows
. Exact original N=16 grid covariance matrices for independent equal-variance sample errors. Each matrix is divided by its own diagonal variance, so the plot compares correlation structure rather than absolute noise level. The corner bands arise from cyclic bin indexing. No sampled experimental data or random simulation is used. Details.Correlation of neighboring periodogram powers is different from the sign of this complex covariance. Suppose each input sample has independent Gaussian real and imaginary parts, each of variance , with all components independent across time. The nonconjugated second moments vanish. Gaussian fourth-moment pairing, as in Isserlis's theorem, then givesConsequently neighboring Hann-bin powers are positively correlated despite the negative covariance of their complex amplitudes. If , their individual power variances are , and the variance of their arithmetic mean isTreating them as independent would incorrectly give . For real Gaussian input, a further term enters the power covariance; the pseudo-covariance of a complex random variable and conjugate-frequency symmetry therefore need attention near paired bins and the real-valued endpoint bins.
Zero padding creates more closely spaced evaluations of the same record, not more independent noise realizations. Even a rectangular record generally has correlated estimates on that denser grid. Detrending, colored input noise and overlapping records change the covariance calculation too. SciPy exposes detrending and FFT-length choices explicitly; its default constant detrending must be disabled when testing the unmodified independent-sample model above.[ref]
A proposed numerical check generates many independent records with the stated noise distribution, computes the estimates with fixed coefficients, and compares empirical complex covariance and power covariance separately with the formulas. A physical noise test additionally needs a characterized acquisition bandwidth and an assessment of time-sample correlation. Averaging several correlated spectral values does not supply the same precision gain as averaging independent records.
Past exam of the physics A course of the University of Cambridge 2014 Paper 2 Section A 3 Solution 2026-10-20
The power linewidth is . Fourier frequency resolution is of order , so , and preferably longer to distinguish the intrinsic linewidth from the observation-window width. zero padding does not improve this physical resolution. A freely decaying signal also needs sufficient microphone dynamic range.
Scalloping loss 2026-11-05
Scalloping loss is the underestimate of an isolated sinusoidal amplitude caused by measuring it only at the nearest sampled discrete Fourier transform frequency, after correcting the window’s coherent amplitude scale. An off-grid tone is evaluated away from the maximum of the window response. This differs from the coherent gain of a window, which describes the response at the correctly centered frequency. The instrument manual treats amplitude scaling and off-bin errors separately.[ref]
Let be a finite real window with positive sum, and let , where is the nearest unpadded DFT bin and . Write . The coherent-gain-corrected bin magnitude relative to isHere is a positive loss when . The half-bin amplitude response of a window evaluates this ratio at the largest nearest-bin offset. Other tones, noise and the negative-frequency image of a real sinusoid can also affect a measured peak; the derivation isolates one complex tone.
For a rectangular window, its geometric-sum transform givesFor , the half-bin ratio is about and the loss about . An amplitude-one tone exactly centered on a bin is recovered as one, while the same tone shifted by half a bin gives only about at either nearest bin. Dividing by coherent gain cannot remove this offset dependence.
For the periodic Hann window, usewhere is the rectangular response. At , this gives a half-bin ratio about , or loss. The smaller nearest-bin error comes with a wider main lobe and a larger equivalent noise bandwidth; window choice affects several measurement properties at once.
Zero padding reduces the nearest-grid offset without changing the measured record. Padding to points makes the nearest offset at most in original-bin units. With and , the rectangular response at that worst offset is about , a loss of only . This is denser sampling of the same discrete-time Fourier transform, not extra physical frequency resolution. A fitted peak can reduce a grid error too, but its signal model and noise sensitivity must be stated.
A proposed analyzer test holds tone amplitude fixed while sweeping frequency through one bin interval, retaining record length, sampling rate and window. Divide out coherent gain, plot the measured peak versus fractional-bin offset, and compare with the exact response above. Include phase and nearby-tone checks for a real signal. Summing spectral powers instead answers an energy question and requires its own bandwidth normalization; it should not silently replace this single-bin amplitude definition.

