how to convert delaunay triangulation to .stl (stereolithography) format? - matlab
I have found several tools which convert isosurface - class or meshgrid data in MATLAB to an STL format. Examples include stlwrite and surf2stl . What I can't quite figure out is how to take a delaunayTriangulation object and either uses it to create an STL file or convert it into an isosurface object.
The root problem is that I'm starting with an N-by-2 array of boundary points for irregular polygons, so I don't have any simple way to generate an xyz meshgrid. If there's a way to convert the boundary list into an isosurface of the interior region (constant Z-height is all I need), that would also solve my problem.
Otherwise, I need some way to convert the delaunayTriangulation object into something the referenced MATLAB FEX tools can handle.
edit to respond to Ander B's suggestion:
I verified that my triangulated set inside MATLAB is a 2-D sector of a circle. But when I feed the data to stlwrite , and import into Cura , I get a disaster - triangles at right angles or rotate pi from desired, or worse. Whether this is the fault of stlwrite , Cura being sensitive to some unexpected value, or both I can't tell. HEre's what started out as a disc:
As an example, here's a set of points which define a sector of a circle. I can successfully create a delaunayTriangulation object from these data.
>> [fcx1',fcy1']
ans =
100.4563 26.9172
99.9712 28.6663
99.4557 30.4067
98.9099 32.1378
98.3339 33.8591
97.7280 35.5701
97.0924 37.2703
96.4271 38.9591
95.7325 40.6360
95.0087 42.3006
94.2560 43.9523
93.4746 45.5906
92.6647 47.2150
91.8265 48.8250
90.9604 50.4202
90.0666 52.0000
89.1454 53.5640
88.1970 55.1116
87.2217 56.6425
86.2199 58.1561
85.1918 59.6519
84.1378 61.1297
83.0581 62.5888
81.9531 64.0288
80.8232 65.4493
79.6686 66.8499
78.4898 68.2301
77.2871 69.5896
76.0608 70.9278
74.8113 72.2445
73.5391 73.5391
72.2445 74.8113
70.9278 76.0608
69.5896 77.2871
68.2301 78.4898
66.8499 79.6686
65.4493 80.8232
64.0288 81.9531
62.5888 83.0581
61.1297 84.1378
59.6519 85.1918
58.1561 86.2199
56.6425 87.2217
55.1116 88.1970
53.5640 89.1454
52.0000 90.0666
50.4202 90.9604
48.8250 91.8265
47.2150 92.6647
45.5906 93.4746
43.9523 94.2560
42.3006 95.0087
40.6360 95.7325
38.9591 96.4271
37.2703 97.0924
35.5701 97.7280
33.8591 98.3339
32.1378 98.9099
30.4067 99.4557
28.6663 99.9712
26.9172 100.4563
25.1599 100.9108
23.3949 101.3345
21.6228 101.7274
19.8441 102.0892
18.0594 102.4200
16.2692 102.7196
14.4740 102.9879
12.6744 103.2248
10.8710 103.4303
9.0642 103.6042
7.2547 103.7467
5.4429 103.8575
3.6295 103.9366
1.8151 103.9842
0 104.0000
-1.8151 103.9842
-3.6295 103.9366
-5.4429 103.8575
-7.2547 103.7467
-9.0642 103.6042
-10.8710 103.4303
-12.6744 103.2248
-14.4740 102.9879
-16.2692 102.7196
-18.0594 102.4200
-19.8441 102.0892
-21.6228 101.7274
-23.3949 101.3345
-25.1599 100.9108
-26.9172 100.4563
0 0
Building on Ander B's answer, here is the complete sequence. These steps ensure that even concave polygons are properly handled.
Start with two vectors containing all the x and the y coordinates. Then:
% build the constraint list
constr=[ (1:(numel(x)-1))' (2:numel(x))' ; numel(x) 1;];
foodel = delaunayTriangulation(x',y',constr);
% get logical indices of interior triangles
inout = isInterior(foodel);
% if desired, plot the triangles and the original points to verify.
% triplot(foodel.ConnectivityList(inout, :),...
foodel.Points(:,1),foodel.Points(:,2), 'r')
% hold on
% plot(fooa.Points(:,1),fooa.Points(:,2),'g')
% now solidify
% need to create dummy 3rd column of points for a solid
point3 = [foodel.Points,ones(numel(foodel.Points(:,1)),1)];
% pick any negative 'elevation' to make the area into a solid
[solface,solvert] = surf2solid(foodel.ConnectivityList(inout,:),...
point3, 'Elevation', -10);
stlwrite('myfigure.stl',solface,solvert);
I've successfully turned some 'ugly' concave polygons into STLs that Cura is happy to turn into gCode.
STL is just a format to store in memory mesh information, thus you have the data if you have a mesh, you just need to write it to memory using the right format.
It appears that you input the vertices and faces to the stlwrite function as
stlwrite(FILE, FACES, VERTICES);
And the delaunayTriangulation output gives you a object that has easy access to this data as for an object DT, DT.Points is the vertices, and DT.ConnectivityList is the faces.
You can read more about it in the documentation you linked.
Related
DIY 3D-Scanner with Matlab, Add a bottom and a lid, converting to .STL
I have big troubles with my DIY 3D-Scanner. But first I have to give you some Backround: I scan an object with the time-of-flight principes. An I want so analyse my raw measurement data with some Matlab code. And in the end I have three matrices with my x,y, and z points. But now I just have a thin surface . Specialy just the surface I scanned. Now I have to create a bottom and a lid. My Idea was so fill the parts of my plot with fill3(); an in my plot I get the correct form. But I cants transform it with surf2stl(); To summerrize my Question: Has anybody an idea to put on a bottom an lid at the sidewall? So I can transorm a closed body with surf2stl();? My Figure: Code: alpha=[0,18,36,54,72,90,108,126,144,162,180,198,216,234,252,270,288,306,324,342,360,378,396,414,432,450,468,486,504,522,540,558,576,594,612,630,648,666,684,702,720,738,756,774,792,810,828,846,864,882,900,918,936,954,972,990,1008,1026,1044,1062,1080,1098,1116,1134,1152,1170,1188,1206,1224,1242,1260,1278,1296,1314,1332,1350,1368,1386,1404,1422,1440,1458,1476,1494,1512,1530,1548,1566,1584,1602,1620,1638,1656,1674,1692,1710,1728,1746,1764,1782,1800,1818,1836,1854,1872,1890,1908,1926,1944,1962,1980,1998,2016,2034,2052,2070,2088,2106,2124,2142,2160,2178,2196,2214,2232,2250,2268,2286,2304,2322,2340,2358,2376,2394,2412,2430,2448,2466,2484,2502,2520,2538,2556,2574,2592,2610,2628,2646,2664,2682,2700,2718,2736,2754,2772,2790,2808,2826,2844,2862,2880,2898,2916,2934,2952,2970,2988,3006,3024,3042,3060,3078,3096,3114,3132,3150,3168,3186,3204,3222,3240,3258,3276,3294,3312,3330,3348,3366,3384,3402,3420,3438,3456,3474,3492,3510,3528,3546,3564,3582,0,18,36,54,72,90,108,126,144,162,180,198,216,234,252,270,288,306,324,342,360,378,396,414,432,450,468,486,504,522,540,558,576,594,612,630,648,666,684,702,720,738,756,774,792,810,828,846,864,882,900,918,936,954,972,990,1008,1026,1044,1062,1080,1098,1116,1134,1152,1170,1188,1206,1224,1242,1260,1278,1296,1314,1332,1350,1368,1386,1404,1422,1440,1458,1476,1494,1512,1530,1548,1566,1584,1602,1620,1638,1656,1674,1692,1710,1728,1746,1764,1782,1800,1818,1836,1854,1872,1890,1908,1926,1944,1962,1980,1998,2016,2034,2052,2070,2088,2106,2124,2142,2160,2178,2196,2214,2232,2250,2268,2286,2304,2322,2340,2358,2376,2394,2412,2430,2448,2466,2484,2502,2520,2538,2556,2574,2592,2610,2628,2646,2664,2682,2700,2718,2736,2754,2772,2790,2808,2826,2844,2862,2880,2898,2916,2934,2952,2970,2988,3006,3024,3042,3060,3078,3096,3114,3132,3150,3168,3186,3204,3222,3240,3258,3276,3294,3312,3330,3348,3366,3384,3402,3420,3438,3456,3474,3492,3510,3528,3546,3564,3582,0,18,36,54,72,90,108,126,144,162,180,198,216,234,252,270,288,306,324,342,360,378,396,414,432,450,468,486,504,522,540,558,576,594,612,630,648,666,684,702,720,738,756,774,792,810,828,846,864,882,900,918,936,954,972,990,1008,1026,1044,1062,1080,1098,1116,1134,1152,1170,1188,1206,1224,1242,1260,1278,1296,1314,1332,1350,1368,1386,1404,1422,1440,1458,1476,1494,1512,1530,1548,1566,1584,1602,1620,1638,1656,1674,1692,1710,1728,1746,1764,1782,1800,1818,1836,1854,1872,1890,1908,1926,1944,1962,1980,1998,2016,2034,2052,2070,2088,2106,2124,2142,2160,2178,2196,2214,2232,2250,2268,2286,2304,2322,2340,2358,2376,2394,2412,2430,2448,2466,2484,2502,2520,2538,2556,2574,2592,2610,2628,2646,2664,2682,2700,2718,2736,2754,2772,2790,2808,2826,2844,2862,2880,2898,2916,2934,2952,2970,2988,3006,3024,3042,3060,3078,3096,3114,3132,3150,3168,3186,3204,3222,3240,3258,3276,3294,3312,3330,3348,3366,3384,3402,3420,3438,3456,3474,3492,3510,3528,3546,3564,3582]' * (pi/1800); radius=[276,274,278,276,270,268,276,278,272,282,282,280,290,278,276,272,284,280,282,268,280,270,282,274,286,286,270,284,282,284,286,274,276,288,282,286,280,282,288,278,288,286,290,294,296,280,286,294,288,288,288,286,286,290,292,292,306,290,300,302,284,302,292,292,292,294,304,286,286,290,298,310,294,304,306,292,296,300,296,298,300,300,304,312,308,304,308,310,296,300,294,298,294,312,298,294,300,312,306,300,304,306,302,304,308,302,312,300,300,308,304,300,306,292,290,300,302,290,288,298,300,296,298,298,308,312,298,298,296,298,292,298,300,298,284,300,294,288,290,294,284,288,302,292,296,302,298,282,290,288,278,288,280,286,294,284,300,284,298,282,274,280,298,280,278,280,282,272,280,282,278,274,278,280,266,282,284,274,276,274,276,276,288,274,270,274,278,280,274,270,274,280,276,272,276,282,278,284,284,284,284,270,274,266,274,286,282,276,270,286,286,276,282,278,270,270,278,280,276,274,270,276,282,270,280,292,288,276,274,282,280,280,282,286,290,276,286,282,292,284,300,286,290,290,294,286,288,290,290,294,298,290,296,284,282,288,286,294,294,292,294,296,296,300,298,292,296,302,302,296,296,298,300,292,306,296,300,292,286,300,294,298,294,298,312,304,300,294,302,298,298,296,290,300,298,296,302,298,294,300,304,298,308,292,302,300,296,298,300,302,300,294,292,302,298,298,300,294,292,302,296,296,290,302,304,298,304,300,296,298,296,288,298,288,296,298,300,288,296,286,290,288,292,292,298,288,294,286,280,292,288,290,284,282,282,286,286,290,288,288,286,294,290,282,280,280,282,286,278,276,270,272,280,276,276,278,280,274,278,276,276,278,278,286,278,274,280,278,274,272,276,276,266,272,276,272,274,270,274,282,268,264,256,262,264,258,266,258,256,262,256,258,248,270,272,260,264,268,264,262,268,260,260,264,262,260,260,268,272,264,262,258,268,270,268,272,280,266,270,262,278,282,280,268,268,268,280,274,292,286,292,276,290,296,292,286,290,290,290,288,284,290,282,282,278,290,280,290,286,284,284,292,286,290,298,298,310,302,292,298,296,306,292,286,284,274,274,274,276,272,280,274,276,278,280,284,290,280,272,280,286,284,276,272,284,280,274,270,278,280,286,284,286,286,282,282,286,280,290,274,284,272,274,274,266,270,270,276,272,272,266,264,262,278,272,268,274,278,270,278,266,276,274,272,266,278,264,272,258,272,274,266,266,276,272,274,270,276,268,264,266,270,274,270,282,264,272,266,274,284,266,266,278,260,272,270,248,266,260,274,256,254,254,264,272,258,250,266,250,264,262,254,260,256,266,266,262,252,254,258]' * (1/10); height=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]'; H=length(height)/steps; alpha2=zeros(H,steps); radius2=zeros(H,steps); height2=zeros(H,steps); g=zeros(H,steps); alpha3=zeros(H,steps+1); radius3=zeros(H,steps+1); height3=zeros(H,steps+1); p=0.95; xxi=(0:2*pi/steps:(2*pi-(2*pi/steps))); for i=1:H for j=1:steps alpha2(i,j)=alpha(j+(i-1)*steps,1); radius2(i,j)=radius(j+(i-1)*steps,1); height2(i,j)=height(j+(i-1)*steps,1); end end for i=1:1:H g(i,:)=csaps(alpha2(i,:), radius2(i,:), p, xxi); end alpha3(:,steps+1)=alpha2(:,1); radius3(:,steps+1)=g(:,1); height3(:,steps+1)=height2(:,1); for i=1:H for j=1:steps alpha3(i,j)=alpha2(i,j); radius3(i,j)=g(i,j); height3(i,j)=height2(i,j); end end [x,y,z]=pol2cart(alpha3,radius3,height3); surf (x,y,z) hold on %fill3(x(size(z,1),:,:), y(size(z,1),:,:),z(size(z,1),:,:),'r'); %fill3(x(1,:,:), y(1,:,:),z(1,:,:),'k'); %Dosen't work with surf2stl, becaus I can not transform it in suitable %coordinates! surf2stl('test.stl',x,y,z);
interp1 'next' appears to give 'nearest'
I have a series of z values zk and a temperature value Tadjust0 at each zk. From this I'd like to create a series of steps of height Tadjust0(j) going from zk(j-1) to zk(j). I'm trying to achieve this with: zk=[40.41; 50.04; 59.56; 68.95; 78.22; 87.40; 99.95]; Tadjust0=[-1.1500; 1.6033; 2.4287; 3.2430; 3.8500; 3.8500; 3.8500]; zo=[1:0.01:100]; Tadjust1=interp1(zk,Tadjust0,zo,'next','extrap'); figure plot(zo,Tadjust1) figure scatter(zk,Tadjust0) But as far as I can tell, the interpolation seems to be using 'nearest' rather than 'next': the steps don't end at zk(j), they end at (zk(j)+zk(j+1))/2. In fact, if I change the code to 'nearest' I get exactly the same plots.
I suspect that the problem lies within the simultaneous use of next neighbour interpolation and extrapolation. You can separate the interpolation and extrapolation to be sure: zk=[40.41; 50.04; 59.56; 68.95; 78.22; 87.40; 99.95]; Tadjust0=[-1.1500; 1.6033; 2.4287; 3.2430; 3.8500; 3.8500; 3.8500]; zo=[1:0.01:100]; % Nearest neigbour inter-/ extrapolation Tadjust1=interp1(zk,Tadjust0,zo,'nearest','extrap'); % Get indices of zo within the range of zk interp_range = zo > min(zk) & zo < max(zk); % Replace the interpolated values by next neighbour interpolation Tadjust1(interp_range)=interp1(zk,Tadjust0,zo(interp_range),'next'); figure plot(zo,Tadjust1) figure scatter(zk,Tadjust0) Raw data: Result:
Augmenting Latin Hypercube Points in MATLAB
I would like to know what are the commands to create a LHS design and then augment it with more points later on if the model is not good enough? For example, I will first create a 50 points LHS design, then add more points (perhaps in batches of 20) incrementally until the model is accurate enough. For example: Set1=lhsdesign(5,5); %5x5 matrix %Use of set 1, then determine more points are needed Set2=%some command that adds 20 points to Set1 to make it a 25x5 matrix The difficulty in running lhsdesign again for the 20 new points do not take account of the original points. There is also work done using the original points and so by generating a new set of points from scratch wastes this work as the new points are not included in the new set.
I was able to make a function that solves this problem. I am not sure the final matrix is a true latin hypercube, but it adds the required number of points to the given points and moves them to the closest available open 'channel' (Sub range where no point exists) if need be. Usage is as follows: x1=lhsdesign(200,17); xF=lhsaugment(x1,200); Which adds 200 points to the x1 set of points, resulting in xF being a 400x17 matrix. Function is as follows: function xF = lhsaugment(x1,nPoi) %function xF = lhsaugment(x1,nPoi) %Function to augment a given latin hypercube x1 by a number of points, %nPoi. Only the length is changed, i.e. points are added to the length. %The original points are left unctouched and appear first in the output %xF. Thus the size of xF is [size(x1,1)+nPoi size(x1,2)]. x2=lhsdesign(nPoi,size(x1,2)); nPoi=size(x2,1); oPoi=size(x1,1); tPoi=nPoi+oPoi; fInt=1/tPoi; for i=1:tPoi cBound(i,:)=[(i-1)*fInt i*fInt]; end xF=zeros(tPoi,size(x1,2)); bX1=zeros(size(x1)); bX2=zeros(size(x2)); bF=zeros(tPoi,size(x1,2)); iF=zeros(1,size(x1,2)); iMove=0; for i=1:oPoi for j=1:size(cBound,1) for l=1:size(x1,2) if (x1(i,l)>cBound(j,1))&&(x1(i,l)<=cBound(j,2))&&(bF(j,l)==0) iF(1,l)=iF(1,l)+1; xF(iF(1,l),l)=x1(i,l); bX1(i,l)=1; bF(j,l)=1; elseif (x1(i,l)>cBound(j,1))&&(x1(i,l)<=cBound(j,2))&&(bF(j,l)~=0) iMin=size(cBound,1); pMin=size(cBound,1); for m=j:-1:1 if (bF(m,l)==0) iMin=m; pMin=j-m; break end end for m=j:size(cBound,1) if (bF(m,l)==0)&&(m-j<pMin) iMin=m; pMin=j+m; break end end iF(1,l)=iF(1,l)+1; xF(iF(1,l),l)=x1(i,l); bX1(i,l)=1; bF(iMin,l)=1; end end end end for i=1:nPoi for j=1:size(cBound,1) for l=1:size(x2,2) if (x2(i,l)>cBound(j,1))&&(x2(i,l)<=cBound(j,2))&&(bF(j,l)==0) iF(1,l)=iF(1,l)+1; xF(iF(1,l),l)=x2(i,l); bX2(i,l)=1; bF(j,l)=1; elseif (x2(i,l)>cBound(j,1))&&(x2(i,l)<=cBound(j,2))&&(bF(j,l)~=0) iMin=size(cBound,1); pMin=size(cBound,1); for m=j:-1:1 if (bF(m,l)==0) iMin=m; pMin=j-m; break end end for m=j:size(cBound,1) if (bF(m,l)==0)&&(m-j<pMin) iMin=m; pMin=j+m; break end end iF(1,l)=iF(1,l)+1; xF(iF(1,l),l)=(x2(i,l)-(floor(x2(i,l)/fInt)*fInt))+((iMin-1)*fInt); bX2(i,l)=1; bF(iMin,l)=1; if l==1 iMove=iMove+1; end end end end end
Matlab: Colour grade a Constellation Diagram
I am using Matlab. I have a large column vector consisting of complex values. e.g. data=[ -0.4447 + 0.6263i 0.3114 + 0.8654i 0.7201 + 0.6808i 0.7566 + 0.8177i -0.7532 - 0.8085i -0.7851 + 0.6042i -0.7351 - 0.8725i -0.4580 + 0.8053i 0.5775 - 0.6369i 0.7073 - 0.5565i 0.4939 - 0.7015i -0.4981 + 0.8112i .... ] This represents a constellation diagram which is shown below. I would like to colour grade the constellation points depending on frequency at a particular point. I presume I need to create a histogram, but I am not sure how to do this using complex vectors and then how to plot the colour grade. Any help appreciated.
I think you want to do a heat map: histdata = [real(data), imag(data)]; nbins_x = nbins_y = 10; [N, C] = hist3(histdata, [nbins_x, nbins_y]); % the second argument is optional. imagesc(N); Here hist3 creates the histogram-matrix, imagesc draws a scaled heat-map. If you prefer a 3d-visualization, just type hist3(histdata). If you just right-click on N in the workspace window there are plenty of other visualization options. I suggest also trying contourf(N) which is a filled contour plot.
So, what you want to do is to find a two-2 histogram. The easiest way would be to separate out the real and imaginary points, and use the hist2d function, like this: rdata=real(data); idata=imag(data); hist2d([rdata;idata]);
MATLAB XYZ to Grid
I have a tab separated XYZ file which contains 3 columns, e.g. 586231.8 2525785.4 15.11 586215.1 2525785.8 14.6 586164.7 2525941 14.58 586199.4 2525857.8 15.22 586219.8 2525731 14.6 586242.2 2525829.2 14.41 Columns 1 and 2 are the X and Y coordinates (in UTM meters) and column 3 is the associated Z value at the point X,Y; e.g. the elevation (z) at a point is given as z(x,y) I can read in this file using dlmread() to get 3 variables in the workspace, e.g. X = 41322x1 double, but I would like to create a surface of size (m x n) using these variables. How would I go about this? Following from the comments below, I tried using TriScatteredInterp (see commands below). I keep getting the result shown below (it appears to be getting some of my surface though): Any ideas what is going on to cause this result? I think the problem lies with themeshgrid command, though I'm not sure where (or why). I am currently putting in the following set of commands to calculate the above figure (my X and Y columns are in meters, and I know my grid size is 8m, hence ti/tj going up in 8s): F = TriScatteredInterp(x,y,z,'nearest'); ti = ((min(x)):8:(max(x))); tj = ((min(y)):8:(max(y))); [qx,qy] = meshgrid(ti,tj); qz = F(qx,qy); imagesc(qz) %produces the above figure^
I think you want the griddata function. See Interpolating Scattered Data in MATLAB help.
Griddata and tirscattteredinterp are extremely slow. Use the utm2deg function on the file exchange and from there a combination of both vec2mtx to make a regular grid and then imbedm to fit the data to the grid. I.E. for i = 1:length(X) [Lat,Lon ] = utm2deg(Easting ,Northing ,Zone); end [Grid, R] = vec2mtx(Lat, Lon, gridsize); Grid= imbedm(Lat, Lon,z, Grid, R);
Maybe you are looking for the function "ndgrid(x,y)" or "meshgrid(x,y)"