How to create meshgrid for unequal metrix.

I am trying to plot pressure contour for roof (40'X125') where 8 main tap lines are given and another 7 sub tap lines starts after 99'; hence, tributary dimensions in 1 direction is reduced after 99'. Therefore, how to create meshgrid in this case. Image is given here for the reference.

 Accepted Answer

The answer below shows how to create a grid that is non-uniform. The figures in the answer show how it worked.
However, the answer above does not reproduce a pattern like the one in your figure. meshgrid() cannot make a mesh like the one in your figure, because your figure has different numbers of rows for different columns.
I do not understand exactly what you are trying to do with the diagram shown. Do you have measurements at the dots shown on the diagram, and you want to make a contour plot using the measured values?
.

5 Comments

Hello William,
First of all, thank you for your response. I am trying to create contour plot for points which are shown in the figure. Figure shows that Left part has only 8 lines of taps while right part shows 15 lines of taps which creates unequal matrix, and I want to make contour in a such a way that it captures pressure at all points.
I notice that the x-values for each column of dots are the same. That is, the columns of dots are all exactly aligned. The y-values , however, are uneven: the spacing in the y direction is half as wide for x>99.
If I had data at the dot points, and if it was my goal to make a contour plot, I would use meshgrid() to make a grid with 19x15 points. This grid will include all the points where I have data, plus some points where I do not have data. I would use linear interpolation to fill in the values at the points where I do not have data. After I have filled in the data at the grid points where there was no data, I would use contour() to make the contour plot.
[X,Y]=meshgrid([0:12.5:75,81:6:99,102:26/7:128],[1:38/14:39]);
plot(X,Y,'r+'); xlim([0,128])
z=zeros(size(X));
for i=2:2:14
z(i,1:10)=1; %z=1 where we are missing data
end
z(15,4)=1; z(5,7)=1; %z=1 missing data points, special cases
zc=~z; %zc=1 where we DO have data
hold on; plot(X(zc),Y(zc),'b.')
The + symbols are all the points in the mesh. The blue points are where we have data. I think the blue points above match your blue dots. The matrix z equals 1, or true, where you need to interpolate a value.
Noted and thank you for your response. I will try this.
@Jigar, you're welcome. Good luck with your work.

Sign in to comment.

More Answers (0)

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!