conv2(B, A)


2-D convolution of the matrix B with the matrix A. Uses 2-D FFT algorithm


julia> u = [1, 2, 1];
julia> v = [1, 0, -1];
julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> conv2(u, v, A)
3×3 Array{Int64,2}:
 -1   0   1
 -4   0   4
 -7   0   7

In this example, conv2 performs a 2-D convolution of the matrix A with the separable kernel generated by vectors u and v. The resulting convolution matrix is returned.

Common mistake example:

julia> u = [1, 2, 1];
julia> v = [1, 0, -1];
julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> conv2(u, v, A)
ERROR: MethodError: no method matching conv2(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,2})

In this example, the inputs u and v are provided as 1-D arrays instead of 2-D arrays. The conv2 function expects 2-D arrays for u and v, so make sure to pass the correct input dimensions to avoid this error.

See Also

Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field

Checking you are not a robot: