
2D Line Interpolation
11 views (last 30 days)
Show older comments
Muhammad Zafar Iqbal
on 5 Jun 2020
Commented: Muhammad Zafar Iqbal
on 6 Jun 2020
Hi
I have data in 2D as a line data (example given as)
y1 x1 y2 x2 val err
36.97 126.5 36.79 126.45 394.94 1.79
36.98 126.4 36.79 126.45 179.59 0.75
37 126.65 36.55 126.64 82.64 0.35
37.4 127.21 37.35 126.7 379.76 1.53
34.75 127.17 34.4 126.7 172.95 0.73
37.45 126.82 37.89 126.77 401.29 1.6
36.98 126.4 37.08 126.77 1168.43 4.97
37.4 127.21 37.89 126.77 114.6 0.52
35.32 127.45 34.98 126.9 289.95 1.19
36.97 126.5 37.49 126.92 3462.07 15.01
37.16 127.52 37.49 126.92 151.54 0.61
37.4 127.21 37.49 126.92 167.04 0.69
37.16 127.52 37.49 126.92 240.72 1.01
36.2 127.48 36.27 126.92 235.94 0.95
36.35 127.2 36.27 126.92 155.95 0.63
35.27 127.42 35.49 126.93 1002.81 4.37
35.32 127.45 35.49 126.93 756.71 3.24
36.97 126.5 37.28 126.98 262.64 1.16
37.4 127.21 37.28 126.98 118 0.49
36.9 126.59 37.28 126.98 114.9 0.49
35.27 127.42 35.16 126.99 180.78 0.61
I need to interpolate the data. (The gridded data must be shown within the limits as defined by the user as Y (35.5 - 36.5) and X (128.5 - 129.5)
How I can do it. Waiting for your kind reply.
5 Comments
Accepted Answer
KSSV
on 5 Jun 2020
data = [36.97 126.5 36.79 126.45 394.94 1.79
36.98 126.4 36.79 126.45 179.59 0.75
37 126.65 36.55 126.64 82.64 0.35
37.4 127.21 37.35 126.7 379.76 1.53
34.75 127.17 34.4 126.7 172.95 0.73
37.45 126.82 37.89 126.77 401.29 1.6
36.98 126.4 37.08 126.77 1168.43 4.97
37.4 127.21 37.89 126.77 114.6 0.52
35.32 127.45 34.98 126.9 289.95 1.19
36.97 126.5 37.49 126.92 3462.07 15.01
37.16 127.52 37.49 126.92 151.54 0.61
37.4 127.21 37.49 126.92 167.04 0.69
37.16 127.52 37.49 126.92 240.72 1.01
36.2 127.48 36.27 126.92 235.94 0.95
36.35 127.2 36.27 126.92 155.95 0.63
35.27 127.42 35.49 126.93 1002.81 4.37
35.32 127.45 35.49 126.93 756.71 3.24
36.97 126.5 37.28 126.98 262.64 1.16
37.4 127.21 37.28 126.98 118 0.49
36.9 126.59 37.28 126.98 114.9 0.49
35.27 127.42 35.16 126.99 180.78 0.61 ] ;
y1 = data(:,1) ; y2 = data(:,3) ;
x1 = data(:,2) ; x2 = data(:,4) ;
val = data(:,5) ; err = data(:,6) ;
m = 100 ;
xi = linspace(min(x1),max(x1),m) ;
yi = linspace(min(y1),max(y1),m) ;
[X,Y] = meshgrid(xi,yi) ;
V = griddata(x1,y1,val,X,Y) ;
pcolor(X,Y,V)
shading interp
More Answers (0)
See Also
Categories
Find more on Spline Postprocessing 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!