卷积函数:

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. zabbix agent主动模式与proxy模式,实现公网zabbix监控私网客户机

    zabbix agent主动模式,实现公网zabbix监控私网客户机 zabbix_server端当主机数量过多的时候,由Server端去收集数据,Zabbix会出现严重的性能问题,主要表现如下:  ...

  2. HTTP头的Expires与Cache-control区别

    2010年3月24日 a18ccms 发表评论 阅读评论 今天在群里聊天.说道了Expires.这里来说明下这两个的区别吧. 1.概念 Cache-control 用于控制HTTP缓存(在HTTP/1 ...

  3. python+selenium+Firefox+pycharm版本匹配

    window(2018-05-29)最新 python:3.6.1    地址https://www.python.org/downloads/release/python-361/ selenium ...

  4. Java静态代码块

    static{ //代码 } 在加载类的时候,会执行静态代码块-->非静态代码块--->构造函数 http://www.cnblogs.com/panjun-Donet/archive/2 ...

  5. dart 公共变量

    dart中可以直接在一个文件里声明一个变量,这在其他语言中并不常见,比如c#语言只有类型才可以在命名空间下定义,变量必须放在类里声明 所以dart这点特性类似于js 今天就来讨论这个公共变量的作用范围 ...

  6. win10 wsl安装 命令行

    用于一些精简版没有商店的安装方法 开启"Windows Subsystem for Linux" 可选特性 打开`PowerShell`,运行下面指令: Enable-Window ...

  7. Junit Test 的时候出错java.lang.IllegalStateException: Failed to load ApplicationContext

    问题原因 JDK1.8    spring版本3.2.0RELEASE JDK和spring版本不兼容 解决方法 1.降低JDK版本到1.7 2.将spring的版本升级到4.0.0RELEASE或者 ...

  8. 设置Windows开机自动启动VirtualBox虚拟机系统

    如果常用VirtualBox虚拟机系统的话,设置随开机启动也是很方便的.不需要打开VirtualBox窗口,直接启动VirtualBox虚拟机系统就可以了. 设置开机自启动VirtualBox虚拟机系 ...

  9. 4600007972内销新单未取进FP

    1.首先检查 in_sales_order表: select * from in_sales_order where so_id='04600007972'发现没有数据 2.接着检查从SAP导数的步骤 ...

  10. MYSQL 测试常用语句使用技巧

     终于有时间可以整理一下工作中常用的sql语句,基本的sql语句及增删改查就不说了.对于测试而言,经常用到的还是造数据,取随机数据和查询.比如造数据时,为了确保数据真实性,可能时间是随机的,用户是随机 ...