简体   繁体   中英

visualization of scattered data over a sphere surface MATLAB

I wrote a 3D finite element code and I have the values of the function C(x,y,z) (FOUND in FEM) on a bunch of scattered data (x,y,z) over a surface of the sphere. I'm trying to visualize the function using surf on MATLAB and I already used griddata to interpolate the function C over the surface of a sphere, however it does not work and I face with the following problem:

Warning: Duplicate xy data points detected: using average of the z values

and the ultimate figure I see at the end is just a poor section of sphere.

If you look at the example given in the matlab documentation for plotting things on a sphere , you will see (among other things) the following lines of code:

k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
surf(x,y,z,c);
colormap([1  1  0; 0  1  1])
axis equal

In this case the points on the surface are defined by their (x, y, z) coefficients, and the color is determined by the matrix c and the colormap [1 1 0; 0 1 1] [1 1 0; 0 1 1] . The error you describe suggests you are using surf(x,y,z) rather than surf(x,y,z,c) to create your plot. If you study the documentation referenced above you may be able to adapt the above to your situation - without a bit more information about your data it's hard to guess at a better answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM