# TriScatteredInterp from 3 lines to get surface

3 views (last 30 days)
Freddie Santiago on 11 Mar 2013
I am trying to compute a surface from 3 lines using interpolation and not getting the expected results. There might be an error in my code which is as follows:
V1 = [0 .12 .15 .19 .22 .3 .32];
P1 = [0 12.54 16.13 20.91 23.83 31.7 34.13];
TR1 = 13*ones(size(V1));
V2 = [0 0.1 0.12 0.15 0.18 0.2 0.25 0.28 0.3 0.35 0.38 0.4];
P2 = [0 14.82 18.05 22.63 27.36 30.31 38.05 42.8 46.82 54.02 58.89 62.75];
TR2 = 26*ones(size(V2));
V3 = [0 0.1075 0.1325 0.1625 0.1925 0.2225];
P3 = [0 28.39 33.87 40.06 46.94 54.7];
TR3 = 40*ones(size(V3));
V = [V1(1:6) V2(1:6) V3(1:6)]';
P = [P1(1:6) P2(1:6) P3(1:6)]';
TR = [TR1(1:6) TR2(1:6) TR3(1:6)]';
F = TriScatteredInterp(V,P,TR, 'linear');
[xq,yq] = meshgrid(0:.1:.4, 0:.1:60);
vq = F(xq,yq);
mesh(vq);
hold on;
plot3(V,P,TR,'o');
Does anyone have any suggestions? Thank you!

ChristianW on 11 Mar 2013
Try
[xq,yq] = meshgrid(0:.01:.4, 0:.1:60);
vq = F(xq,yq);
mesh(xq,yq,vq);

### Categories

Find more on Interpolation 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!