How to map a matrix based on values from another matrix

4 visualizaciones (últimos 30 días)
Kashif
Kashif el 27 de Jun. de 2020
Comentada: Supriya Gain el 19 de Abr. de 2023
Hi,
I have two matrices A (mxn) and B (mxn). I want to make another matrix C (mn xn).
I want to pick a data point from B (i, j) and place in C such that
C (A (i, j), j) = B (i, j)
The issue is A (i, j) can be negative and / or floating.
Is it possible?
  4 comentarios
madhan ravi
madhan ravi el 28 de Jun. de 2020
Did you even look the answer below??
Walter Roberson
Walter Roberson el 28 de Jun. de 2020
What would you want C(-2.6,j) to mean if one of the A values was -2.6?
Are you trying to do scattered interpolation?

Iniciar sesión para comentar.

Respuestas (1)

madhan ravi
madhan ravi el 28 de Jun. de 2020
Editada: madhan ravi el 28 de Jun. de 2020
You could sort(...) and use it’s second output to index (which satisfies the data points needed under needed tolerance) to get what you want, you will have to experiment as per your needs.
  8 comentarios
Walter Roberson
Walter Roberson el 29 de Jun. de 2020
Even a wire grid has interpolation. Lack of interpolation would be like a scatter3() graph, where you just have a bunch of unconnected points, where there exist some locations in which there is an infinitesimally small post that the point sits on, and that between the posts there is either "nonethingness" (nan) or -infinity, with there being no implicit connection between nearby points at all.
surface and wire meshes assume connections between nearby points and draw lines and faces between them, sort of like draping a piece of fabric over the set of points. That is implied interpolation. If you are wanting a surface out, then you should be doing scattered interpolation.
The fact that the two arrays are the same size does not affect whether you should be doing scattered interpolation, because the size of the surface implied by the points is not the same as the number of data points. You want to know the shape of the surface over some bounds, effectively sampling it on a regular grid within the bounds and asking what the height is at each of the sample points.
Supriya Gain
Supriya Gain el 19 de Abr. de 2023
I have a matrix A=[1 2;1 3;1 9] and I have another matrix B which is 203x3. Now I want to map A matrix to B. Like first row to A matrix should be map to first column of B matrix. How to do that!

Iniciar sesión para comentar.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by