卷积函数:

numpy.convolve(avmode='full')

Parameters:

a : (N,) array_like

First one-dimensional input array.

v : (M,) array_like

Second one-dimensional input array.

mode : {‘full’, ‘valid’, ‘same’}, optional

‘full’:

By default, mode is ‘full’. This returns the convolution at each point of overlap, with an output shape of (N+M-1,). At the end-points of the convolution, the signals do not overlap completely, and boundary effects may be seen.

‘same’:

Mode ‘same’ returns output of length max(M, N). Boundary effects are still visible.

‘valid’:

Mode ‘valid’ returns output of length max(M, N) - min(M, N) + 1. The convolution product is only given for points where the signals overlap completely. Values outside the signal boundary have no effect.

Returns:

out : ndarray

Discrete, linear convolution of a and v.

The discrete convolution operation is defined as

It can be shown that a convolution  in time/space is equivalent to the multiplication in the Fourier domain, after appropriate padding (padding is necessary to prevent circular convolution). Since multiplication is more efficient (faster) than convolution, the function scipy.signal.fftconvolveexploits the FFT to calculate the convolution of large data-sets.

Note how the convolution operator flips the second array before “sliding” the two across one another:

>>>

>>> np.convolve([1, 2, 3], [0, 1, 0.5])
array([ 0. , 1. , 2.5, 4. , 1.5])

Only return the middle values of the convolution. Contains boundary effects, where zeros are taken into account:

>>>

>>> np.convolve([1,2,3],[0,1,0.5], 'same')
array([ 1. , 2.5, 4. ])

The two arrays are of the same length, so there is only one position where they completely overlap:

>>>

>>> np.convolve([1,2,3],[0,1,0.5], 'valid')
array([ 2.5])

numpy.convolve()的更多相关文章

  1. numpy.convolve函数用法

    函数numpy.convolve(a, v, mode=‘full’),这是numpy函数中的卷积函数库 参数: a:(N,)输入的一维数组 b:(M,)输入的第二个一维数组 mode:{‘full’ ...

  2. [开发技巧]·Python极简实现滑动平均滤波(基于Numpy.convolve)

    [开发技巧]·Python极简实现滑动平均滤波(基于Numpy.convolve) ​ 1.滑动平均概念 滑动平均滤波法(又称递推平均滤波法),时把连续取N个采样值看成一个队列 ,队列的长度固定为N ...

  3. numpy中的convolve的理解

    https://blog.csdn.net/u011599639/article/details/76254442 函数 numpy.convolve(a, v, mode=‘full’),这是num ...

  4. numpy&pandas基础

    numpy基础 import numpy as np 定义array In [156]: np.ones(3) Out[156]: array([1., 1., 1.]) In [157]: np.o ...

  5. Convolution卷积算法python以numpy,Matplotlib实现

    1:简述 Numpy拥有函数numpy.convolve(a, v, mode='full')[source]¶,通过该函数完成卷积算法并图形化(Matplotlib)实现. 2:卷积定理 原理: 设 ...

  6. 互相关(cross-correlation)及其在Python中的实现

    互相关(cross-correlation)及其在Python中的实现 在这里我想探讨一下“互相关”中的一些概念.正如卷积有线性卷积(linear convolution)和循环卷积(circular ...

  7. Moving Average

    移动平均算法Demo #!/usr/bin/python2.7 # Fetch data from BD and analyse. import json import urllib import t ...

  8. 相关与卷积(数字信号处理)的数学原理及 Python 实现

    数学原理 在数字信号处理中,相关(correlation)可以分为互相关(cross correlation)和自相关(auto-correlation). 互相关是两个数字序列之间的运算:自相关是单 ...

  9. python3绘图示例3(基于matplotlib:折线图等)

    #!/usr/bin/env python# -*- coding:utf-8 -*-from pylab import *from numpy import *import numpy # 数据点图 ...

随机推荐

  1. form中的input的redonly和disable区别

    Readonly和Disabled是用在表单中的两个属性,它们都能够做到使用户不能够更改表单域中的内容.但是它们之间有着微小的差别,总结如下: Readonly只针对input(text / pass ...

  2. OD 实验(二十) - 对反调试程序的逆向分析(一)

    程序: Keyfile.dat 里的内容 该文件中要至少有 9 个 ReverseMe.A: 运行程序 用 OD 打开该程序,运行 弹出的是错误的对话框 该程序发现 OD 对它的调试,所以该程序对 O ...

  3. Java规则引擎及JSR-94[转]

      规则引擎简介 Java规则引擎是推理引擎的一种,它起源于基于规则的专家系统.       Java规则引擎将业务决策从应用程序代码中分离出来,并使用预定义的语义模块编写业务决策.Java规则引擎接 ...

  4. 经典CNN模型计算量与内存需求分析

    表1 CNN经典模型的内存,计算量和参数数量对比 AlexNet VGG16 Inception-v3 模型内存(MB) >200 >500 90-100 参数(百万) 60 138 23 ...

  5. Asp.net 的工作原理

     转:http://www.cnblogs.com/linjiancun/archive/2010/09/14/1825662.html 1.1.1          Asp.net 的工作原理 ...

  6. 加密算法blowfish 多语言

    php加密算法blowfish <?php /** * Created by PhpStorm. * User: Administrator * Date: 2016-02-14 * Time: ...

  7. 解决linux下root运行Elasticsearch异常

    如果以root身份运行将会出现以下问题 root@yxjay:/opt/elasticsearch-2.3.5/bin# ./elasticsearchException in thread &quo ...

  8. json和jsonp的区别(转)

    原文链接:http://www.cnblogs.com/dowinning/archive/2012/04/19/json-jsonp-jquery.html  前言: 说到AJAX就会不可避免的面临 ...

  9. C# Common Keyword II

    [C# Common Keyword II] 1.as 运算符用于在兼容的引用类型之间执行某些类型的转换. class csrefKeywordsOperators { class Base { pu ...

  10. 【hdu6148】Valley Numer【数位dp模板题】

    题意 对于每组数据给出一个整数n(length(n)<=100),找出不大于n的数字中有多少是Valley Numer.对于Valley的定义是它每一位的数字要么是递增,要么是递减,要么是先递减 ...