Clear Filters
Clear Filters

Contur plot from data

1 view (last 30 days)
Francesco Mela
Francesco Mela on 19 Jun 2017
Answered: KSSV on 20 Jun 2017
Hi, I have a big set of data which are in 3 vectors X, Y, Z. Each term of these vector represents the cartesian coordinates of a point [ for point 1 X->X(1), Y->Y(1), Z->Z(1)...], the data are not sort either on X or Y. I want to plot the contur curve for all the points that have the same Z. How can I do?
Thanks!
Data X: 10.00 -10.00 5.00 -5.00 9.89 9.56 9.01 8.26 7.33 6.23 5.00 3.65 2.23 0.75 -0.75 -2.23 -3.65 -5.00 -6.23 -7.33 -8.26 -9.01 -9.56 -9.89 -9.89 -9.56 -9.01 -8.26 -7.33 -6.23 -5.00 -3.65 -2.23 -0.75 0.75 2.23 3.65 5.00 6.23 7.33 8.26 9.01 9.56 9.89 4.80 4.21 3.27 2.08 0.71 -0.71 -2.08 -3.27 -4.21 -4.80 -4.80 -4.21 -3.27 -2.08 -0.71 0.71 2.08 3.27 4.21 4.80 0.00 -0.00 4.16 -4.16 4.16 -4.16 -6.87 6.87 -6.97 6.97 -7.54 7.54 -2.21 2.21 -2.21 2.21 5.88 -5.88 -5.88 5.88 7.85 -7.85 -7.84 7.84 -5.95 5.95 1.75 1.75 -1.75 -1.75 -4.69 4.69 4.69 -4.69 -6.46 6.46 3.70 -3.70 -3.70 3.70 -7.28 7.28 7.02 -7.02 -1.28 -1.28 1.28 1.28 5.74 -5.74 -5.74 5.74 8.06 -8.06 -8.59 8.59 0.00 -0.00 3.35 -3.35 -3.32 3.32 -5.63 5.63 -5.50 5.50 6.18 -6.18 -8.06 8.06 -8.72 8.72 -1.08 -1.08 1.08 1.08 2.99 -2.99 -2.95 2.95 4.76 -4.76 4.75 -4.75 6.04 -6.04 -6.04 6.04 6.85 -6.85 -6.90 6.90 -0.00 0.00 2.65 -2.65 -2.65 2.65 -6.91 6.91 4.97 -4.97 4.97 -4.97 -8.79 8.79 7.21 -7.21 8.09 -8.09
Y: 0.00 0.00 0.00 0.00 -1.49 -2.95 -4.34 -5.63 -6.80 -7.82 -8.66 -9.31 -9.75 -9.97 -9.97 -9.75 -9.31 -8.66 -7.82 -6.80 -5.63 -4.34 -2.95 -1.49 1.49 2.95 4.34 5.63 6.80 7.82 8.66 9.31 9.75 9.97 9.97 9.75 9.31 8.66 7.82 6.80 5.63 4.34 2.95 1.49 -1.41 -2.70 -3.78 -4.55 -4.95 -4.95 -4.55 -3.78 -2.70 -1.41 1.41 2.70 3.78 4.55 4.95 4.95 4.55 3.78 2.70 1.41 -7.64 7.71 6.47 -6.47 -6.47 6.47 3.05 -3.05 -3.25 3.25 0.76 -0.76 7.54 7.54 -7.54 -7.54 5.06 -5.06 5.06 -5.06 1.37 -1.37 2.15 -2.15 -0.99 0.99 5.98 -5.98 -5.98 5.98 -4.06 4.06 -4.08 4.08 1.73 -1.73 7.79 -7.79 7.79 -7.79 4.50 -4.50 4.56 -4.56 -8.52 8.53 -8.52 8.53 6.38 -6.38 6.38 -6.38 2.60 -2.60 -0.48 0.48 -6.19 6.20 5.21 -5.21 5.17 -5.17 -2.61 2.61 2.77 -2.77 -0.41 0.41 3.45 -3.45 1.06 -1.06 -7.12 7.12 -7.12 7.12 6.58 -6.58 6.56 -6.56 5.40 -5.40 -5.40 5.40 3.91 3.89 -3.91 -3.89 5.69 -5.69 5.67 -5.67 8.97 -8.92 8.62 8.62 -8.62 -8.62 -1.91 1.91 7.42 -7.42 -7.42 7.42 -1.78 1.78 0.55 -0.55 3.82 -3.82
Z: 500.00 500.00 100.20 100.20 98.31 63.73 57.43 54.60 53.56 52.88 52.60 52.43 52.36 52.33 52.33 52.36 52.43 52.60 52.87 53.55 54.61 57.37 64.72 97.17 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 100.08 100.00 99.97 99.96 99.96 99.96 99.96 99.97 100.00 100.08 100.30 100.34 100.36 100.36 100.36 100.36 100.36 100.36 100.34 100.30 71.23 349.98 347.70 73.07 73.13 347.72 321.18 107.81 102.82 336.27 280.19 198.41 360.59 360.62 69.68 69.70 350.84 79.29 350.55 79.45 327.64 174.87 355.27 138.82 137.27 180.81 225.82 85.63 85.62 225.84 92.43 221.05 92.57 222.38 242.14 136.01 414.21 63.64 414.23 63.66 404.76 78.80 392.52 79.67 62.90 414.81 62.90 414.82 410.63 67.07 410.56 67.13 387.10 115.22 273.07 345.28 85.75 222.90 221.22 87.53 216.96 88.04 107.89 213.91 210.95 105.61 157.21 180.36 414.15 90.09 384.41 203.35 75.45 310.84 75.46 310.85 312.16 76.14 309.80 76.42 308.50 80.28 80.46 308.05 303.21 302.56 92.62 93.24 430.60 67.12 432.76 66.93 437.21 60.37 440.58 440.58 59.85 59.86 138.17 280.25 434.29 61.89 61.93 434.28 138.78 414.10 248.22 198.83 428.84 81.52

Accepted Answer

KSSV
KSSV on 20 Jun 2017
Do interpolation with X,Y,Z data to a grid using griddata and then plot contours.
X = [10.00 -10.00 5.00 -5.00 9.89 9.56 9.01 8.26 7.33 6.23 5.00 3.65 2.23 0.75 -0.75 -2.23 -3.65 -5.00 -6.23 -7.33 -8.26 -9.01 -9.56 -9.89 -9.89 -9.56 -9.01 -8.26 -7.33 -6.23 -5.00 -3.65 -2.23 -0.75 0.75 2.23 3.65 5.00 6.23 7.33 8.26 9.01 9.56 9.89 4.80 4.21 3.27 2.08 0.71 -0.71 -2.08 -3.27 -4.21 -4.80 -4.80 -4.21 -3.27 -2.08 -0.71 0.71 2.08 3.27 4.21 4.80 0.00 -0.00 4.16 -4.16 4.16 -4.16 -6.87 6.87 -6.97 6.97 -7.54 7.54 -2.21 2.21 -2.21 2.21 5.88 -5.88 -5.88 5.88 7.85 -7.85 -7.84 7.84 -5.95 5.95 1.75 1.75 -1.75 -1.75 -4.69 4.69 4.69 -4.69 -6.46 6.46 3.70 -3.70 -3.70 3.70 -7.28 7.28 7.02 -7.02 -1.28 -1.28 1.28 1.28 5.74 -5.74 -5.74 5.74 8.06 -8.06 -8.59 8.59 0.00 -0.00 3.35 -3.35 -3.32 3.32 -5.63 5.63 -5.50 5.50 6.18 -6.18 -8.06 8.06 -8.72 8.72 -1.08 -1.08 1.08 1.08 2.99 -2.99 -2.95 2.95 4.76 -4.76 4.75 -4.75 6.04 -6.04 -6.04 6.04 6.85 -6.85 -6.90 6.90 -0.00 0.00 2.65 -2.65 -2.65 2.65 -6.91 6.91 4.97 -4.97 4.97 -4.97 -8.79 8.79 7.21 -7.21 8.09 -8.09] ;
Y = [0.00 0.00 0.00 0.00 -1.49 -2.95 -4.34 -5.63 -6.80 -7.82 -8.66 -9.31 -9.75 -9.97 -9.97 -9.75 -9.31 -8.66 -7.82 -6.80 -5.63 -4.34 -2.95 -1.49 1.49 2.95 4.34 5.63 6.80 7.82 8.66 9.31 9.75 9.97 9.97 9.75 9.31 8.66 7.82 6.80 5.63 4.34 2.95 1.49 -1.41 -2.70 -3.78 -4.55 -4.95 -4.95 -4.55 -3.78 -2.70 -1.41 1.41 2.70 3.78 4.55 4.95 4.95 4.55 3.78 2.70 1.41 -7.64 7.71 6.47 -6.47 -6.47 6.47 3.05 -3.05 -3.25 3.25 0.76 -0.76 7.54 7.54 -7.54 -7.54 5.06 -5.06 5.06 -5.06 1.37 -1.37 2.15 -2.15 -0.99 0.99 5.98 -5.98 -5.98 5.98 -4.06 4.06 -4.08 4.08 1.73 -1.73 7.79 -7.79 7.79 -7.79 4.50 -4.50 4.56 -4.56 -8.52 8.53 -8.52 8.53 6.38 -6.38 6.38 -6.38 2.60 -2.60 -0.48 0.48 -6.19 6.20 5.21 -5.21 5.17 -5.17 -2.61 2.61 2.77 -2.77 -0.41 0.41 3.45 -3.45 1.06 -1.06 -7.12 7.12 -7.12 7.12 6.58 -6.58 6.56 -6.56 5.40 -5.40 -5.40 5.40 3.91 3.89 -3.91 -3.89 5.69 -5.69 5.67 -5.67 8.97 -8.92 8.62 8.62 -8.62 -8.62 -1.91 1.91 7.42 -7.42 -7.42 7.42 -1.78 1.78 0.55 -0.55 3.82 -3.82] ;
Z = [500.00 500.00 100.20 100.20 98.31 63.73 57.43 54.60 53.56 52.88 52.60 52.43 52.36 52.33 52.33 52.36 52.43 52.60 52.87 53.55 54.61 57.37 64.72 97.17 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 100.08 100.00 99.97 99.96 99.96 99.96 99.96 99.97 100.00 100.08 100.30 100.34 100.36 100.36 100.36 100.36 100.36 100.36 100.34 100.30 71.23 349.98 347.70 73.07 73.13 347.72 321.18 107.81 102.82 336.27 280.19 198.41 360.59 360.62 69.68 69.70 350.84 79.29 350.55 79.45 327.64 174.87 355.27 138.82 137.27 180.81 225.82 85.63 85.62 225.84 92.43 221.05 92.57 222.38 242.14 136.01 414.21 63.64 414.23 63.66 404.76 78.80 392.52 79.67 62.90 414.81 62.90 414.82 410.63 67.07 410.56 67.13 387.10 115.22 273.07 345.28 85.75 222.90 221.22 87.53 216.96 88.04 107.89 213.91 210.95 105.61 157.21 180.36 414.15 90.09 384.41 203.35 75.45 310.84 75.46 310.85 312.16 76.14 309.80 76.42 308.50 80.28 80.46 308.05 303.21 302.56 92.62 93.24 430.60 67.12 432.76 66.93 437.21 60.37 440.58 440.58 59.85 59.86 138.17 280.25 434.29 61.89 61.93 434.28 138.78 414.10 248.22 198.83 428.84 81.52] ;
%%make grid
x0 = min(X) ; x1 = max(X) ;
y0 = min(Y) ; y1 = max(Y) ;
N = 100 ;
[Xg,Yg] = meshgrid(linspace(x0,x1,N),linspace(y0,y1,N)) ;
% do interpolation
Zg = griddata(X,Y,Z,Xg,Yg) ;
% plot contour
contour3(Xg,Yg,Zg,N)

More Answers (0)

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!