2D Line Interpolation

2 visualizzazioni (ultimi 30 giorni)
Muhammad Zafar Iqbal
Muhammad Zafar Iqbal il 5 Giu 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 Commenti
Muhammad Zafar Iqbal
Muhammad Zafar Iqbal il 5 Giu 2020
val is the corresponding value and err is the standard error
Muhammad Zafar Iqbal
Muhammad Zafar Iqbal il 5 Giu 2020
Dear KSSV
Thanks for your kind help.
I want to ask if we have only two lines as
140.5 35.25 140.75 35.5 10 1
140.25 35.5 140.5 35.75 5 2
What we have to change as when I run for only two lines the error message is
"Matrix dimensions must agree."
Thanks

Accedi per commentare.

Risposta accettata

KSSV
KSSV il 5 Giu 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
  1 Commento
Muhammad Zafar Iqbal
Muhammad Zafar Iqbal il 6 Giu 2020
Dear KSSV
I need your more help
for the same data, I need node values if possible.
Waiting here for your kind reply.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by