I have a problem/error that I believe is very simple, but I am unable to determine what the issue is nonetheless.(adsbygoogle = window.adsbygoogle || []).push({});

I am trying to convolute an image with an impulse response (IE, h = [1 2 3]), but I get incessant errors and I am unsure as to why. My code is:

I get the error "??? Subscripted assignment dimension mismatch.", or alternatively, MATLAB returns "??? Error using ==> conv, A and B must be vectors." if I attempt to zero-pad my impulse response (h), then insert my matrix values of 1, 2, and 3.Code (Text):

A = double(imread('image.jpg'));

B = zeros(514);

h = [1 2 3];

for k = 1:512

B(k,:) = conv[A(k,:),h];

I'm sure that I am missing something very simple here, but I do not know what it is. At the moment, I am running this code in the terminal, although I don't believe that this is the cause of the problem.

Thank you to anyone who helps -- I'm banging my head against the desk.

Edit: Just a quick note... apparently I forgot to convert to grayscale, and for that reason this image was a 3-dimensional matrix, which doesn't fly in this situation. However, I am still unsure as to how to get it formatted properly, as rgb2gray does not give me the output that I was looking for (it converts the image into a bright red color).

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Convolution ('Conv') in MATLAB

Loading...

Similar Threads - Convolution 'Conv' MATLAB | Date |
---|---|

How to program this in Matlab | Feb 28, 2018 |

Mathematica: Convolution Integral | May 20, 2017 |

Fourier Transform and Convolution | Oct 9, 2015 |

Data convolution | Mar 16, 2015 |

MATLAB: Fitting a convolution | Jun 8, 2012 |

**Physics Forums - The Fusion of Science and Community**