MATLAB: Generate grid and coordinates in a rectangle coordinatesgridrectangle i have sides of a rectangle as input and i want to generate a grid that gives as output the coordinates of the internal points. Best Answer Read about meshgrid. Let L and B be the length and breadth of the rectangle. L = 2. ; B = 1. ;m = 100; n = 100 ;l = linspace(0,L,m) ;b = linspace(0,B,n) ;[X,Y] = meshgrid(l,b) ;mesh(X,Y)view(2)If you have the data points for the opposite sides or for the four side, read about transfinite interpolation. https://in.mathworks.com/matlabcentral/fileexchange/40681-transfinite-interpolation Related SolutionsMATLAB: Dicretization from countour nodes 2D. https://www.mathworks.com/matlabcentral/fileexchange/41454-grid-of-points-within-a-polygon MATLAB: How to interpolate gridded matrix to a non-gridded one Because your data points in B are gridded you can simply use any of the Gridded Data Interpolation tools. The fact that your sample points A are not gridded is totally irrelevant. Here is a simple example, adapted from the interp2 help:% gridded data points:[X,Y] = meshgrid(-3:3);V = peaks(X,Y);% non-gridded sample points:Xq = 6*rand(1,1000)-3;Yq = 6*rand(1,1000)-3;%Vq = interp2(X,Y,V,Xq,Yq);%scatter3(Xq,Yq,Vq); Related QuestionGet data within circular ROI
Best Answer