Hello,
I am trying to write a convolution algorithm for learning purposes. I haven’t gotten to the superposition stage yet. I am stuck on prepending 0 to each iteration of the array which I am attempting to do with unshift!. It occurred to me that I might have to declare the size of the array dimensions beforehand so that each row is sized the same. I’m guessing that my code is also extremely inefficient so insight into that arena would be helpful as well! I’ve attached a screenshot of the arrays I am trying to generate to eventually superimpose (right side of image)
Thank you. Currently, I am trying to circularly shift my 2D array on a row by row basis. I used circshift but it is does not shift on a row by row basis. This is my array:
I would like it look like this, where each row is shifted one more than the previous row:
2.0 1.0 -1.0 0.0 0.0 0.0
0.0 4.0 2.0 -2.0 0.0 0.0
0.0 0.0 -2.0 -1.0 1.0 0.0
0.0 0.0 0.0 6.0 3.0 -3.0