Employing RegularizeData3D function

2 views (last 30 days)
Roderick
Roderick on 3 Sep 2024
Answered: Yash on 3 Sep 2024
Dear all
I have a one-dimensional array, let's call it z, which has a given value for each pair of points (x,y). Let's say that x ranges from 0 to 300 and y from 0 to 50, being both 1D arrays too. Now, I am interested in rearrange the data to plot it through imagesc. At the same time, I want to increase the density of values of z within the spatial domain given by the 2D minimum and maximal values of x and y, respectively.
For that, I am using the RegularizeData3D function as follows:
new_x=linspace(min(x),max(x),1000);
new_y=linspace(min(x),max(y),500);
new_z=RegularizeData3D(x,y,z,new_x,new_y,'interp','bicubic','smoothness',1e-4);
However, it seems that new_z has 500x1000 dimensions, so I am not sure about which should be the order of the inputs to RegularizeData3D to a 1000x500 array, so that the each column represents each value of new_x and each row each value of new_y.

Answers (1)

Yash
Yash on 3 Sep 2024
Hello Richard,
I couldn't find detailed documentation for the "RegularizeData3D" function you mentioned. The Add-On page does not specify the output dimensions. However, after reviewing the function code and its behavior, it seems that the output size is xnodes * ynodes, where "xnodes" corresponds to "new_x" and "ynodes" corresponds to "new_y" in your query.
You should avoid directly swapping "new_x" and "new_y" in the code, as this might lead to incorrect output because "new_x" and "x" are related and "new_y" and "y" are related. If you need to adjust the output dimensions, consider transposing the output "new_z" to achieve the desired size.
For more information on how to transpose matrices in MATLAB, you can refer to the following documentation: https://www.mathworks.com/help/matlab/ref/transpose.html
I hope this helps!

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!