Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Remapping Matrix Values (3d to 2d) for Convolution

Subject: Remapping Matrix Values (3d to 2d) for Convolution

From: Anthony Hopf

Date: 4 Apr, 2010 16:32:05

Message: 1 of 1

This is my first post... and I'm hoping I am overlooking something, but thank you in advance for any help.

I am starting off with a 3d matrix of points that are values in space, a simulated volume. Each point is indexed with x, y and z values, e.g. Value = Matrix(xval,yval,zval). I have also calculated the r, theta, and phi values to each point in the simulated volume. Each of these values also have their own matrix, e.g. rvalue = r(xval,yval,zval).

What I would like to do is remap the original Matrix from above using the r, theta, and phi values mentioned for a constant r value to a 2d matrix. I would like to set an r value with a filter like: r > 11e3-dx & r < 11e3+dx. This will likely give me a value for each theta and phi value at that r value. Now I can filter the Matrix only keeping the new values and setting all of the other to NaN, still a 3d matrix. What I would like to do now is take these values in Matrix and map them to a 2d matrix that way I can do a 2d convolution over them and place them back into the 3d matrix.

I realize I don't need to filter the points and replace the other points with NaN's but it was a way for me to visualize what I was doing. My initial thought was to create a for loop that goes through each point and if it meets the criteria place it in the 2d matrix mapped to theta and phi values for a given r value... but this will take forever with a matrix that is 450x450x30. The other issue is that phi ranges -pi to pi so I would need to "unwrap" the 3d space.

Does anyone have any ideas that may help?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us