Two minute video shows how to fit a surface to nonuniform data.
Real data is not always on a nice X,Y grid, but the MATLAB commands
SURF and MESH expect them to be. GRIDDATA and MESHGRID help to fix this.
I am very grad to find the program of “advanced-matlab-surface-plot-of-nonuniform-data”, but I could not run it
because of no-coincide of matrix dimension.
Would you please inform me of a mistake I coded (copied).
%3D graph for nonuniform_data
mesh(X,Y,Z); % interpolated
axis tight; hold on
This info about making a surface plot was very usefull for me. In stead of the formule that you used to produce some points, I used 4 XYZ-coordinates that result in an surface in 3D. Is there an easy way to calculate the surface area of this created object?
There is no built in function to do this, but knowing the X,Y,Z of each point in the mesh, you should be able to calculate the area of each four point patch. From there, summing should be easy to know the whole area.
I am not sure that I understand the question. If you have x,y,z triples, you just plot them. Are you trying to fit a polynomial to them? That would imply a two dimensional dataset. Are you trying to fit some kind of a surface to the data?
i have a question regarding (x,y,z) set of data points. i have a file with x,y,z coordinates (z is depth) and I would compute the dip at each point in both x and y directions. my data has the following conditions:
1- difference between each pair of points in both x and y directions are constant, in other words, delta_x and delta_y are constant (but delta_x ~= delta_y; is not equal which is not important).
2- my surface points could be removed somewhere meaning that in those points i don’t have data.
3- i would use second order of derivative to compute dip at each point.
4- i would have the same number of dip as number of my points (or data ).
I have data set which contains x,y and z coordinates of a finite element model. I want to plot mesh for this model. But the function ‘mesh’ in matlab requires the Z as Z(i,j) where i is size of x and j is size of y. I tried to generate Z(i,j) using
When I am plotting the mesh, it shows me that I have duplicate values. My z coordinate data has duplicate z coodrinates like, it has 0 for few and 0.5 for few, like wise.
Can you please suggest me how to plot this data set?
To be clear, please give the sizes of all your variables (ie. How big are x,y,z. How are they related to one another) Is the data regularly spaced in x and y? Is this a sheet? (only one Z value for any given point in X and Y)
first column is node numbers, second column is x-coord, third column is y-coord and 4th column is z coord. The data is arranged as per the node numbers. There is one more data set which has the mesh relation ship between the nodes and the elements. One element is combination of 8 nodes. it looks like this,
Thank You very much, PATCH worked for me! It requires the input as I got here. I am getting kind of greedy here, I have same kind of deformation data also for the nodes. Actually, I have mesh data for two meshes, One is fine mesh and one is coarse mesh. The shape is same for both the meshes, the difference is only the number of elements and nodes. I have Deformation data for x,y, and z coordinates for fine mesh. I have to do interpolation and find the deformation data for coarse mesh. Again the problem in using interp1, interp2 and interp3 is the same. The data I have is not in the same format these functions need. Is there any function like PATCH for initerpolation which I can use?
This will help me alot in dealing with this problem.
Here is my problem.
x,y are 2 vectors..say of length 400.
z is a 400×400 matrix generated using x and y vectors….i.e. z(i,j) is calculated based on x(i) and y(j).
now when i plot mesh(x,y,z),the wireframe is too dark….how can i increase the spacing between the wires….without decreasing x and y vector sizes.
I have non-uniform scalar data, X, Y, Z, velocity. I would like to use slice or contourslice to look at planes of data, but I can’t figure out how to get the velocity data into the right format to plot. The error says velocity must be a 3D array
I have values of a function on a irregular X,Y grid and I would interpolate it in order to find isocurves where the function is equals to 0.
I used your code but I had an error which says that sample data points should be collinear. I don’t know how to handle this problem.
I spent lot of time to find an other way to do it.
Here is my code :
nx = 5000; % Number of x steps
ny = 5000; % Number of y steps
n = 100; % Time step
x1 = Wzx(:,1); % X-coordinate nodes'
y1 = Wzx(:,2); % Y-coordinate nodes'
z1 = Wzx(:,n); % Wzx values a t=n*dt
% X,Y for regular mesh
xlin = linspace(0,8,nx);
ylin = linspace(0,3.2,nx);
F = TriScatteredInterp(x1,y1,z1); % Interpolant
z = zeros(nx,ny); % Matrix declaration
% Matrix's filling
% For each regular coordinate i,j we evaluate Wzx using the
% Compute the contour matrix for isoline 0
C = contourc(z,[0 0]);
What I’m trying to do is to obtain the coordinates (x,y) of the isoline Wzx(x,y) = 0.
Thus, I interpolate my data on a regular mesh in order to use contourc function which enables me to find 0 isoline.
But my results are not good.
Does my code sound sensible ?
I am trying to plot/show my data with color. I know the data values (z) at each point (x, y). I was trying to use pcolor or imagesc, etc., i.e., pcolor(x, y, z). But as you know my z is a vector, but not a matrix. Do you know how to generate a figure for my data values? I do not want to use plot3(x,y,z).