I plotted recently some figures in Matlab and their quality was not that satisfactory, so I come to Mathematica as my supervisor suggested. This is how such figure looks like in Matlab:
.
In Matlab, I have three m by n matrices A,B,C, whose entries in the corresponding position are the calculated x,y,z coordinates of the points on the surface correspondingly. And each row of the 3 matrices corresponds to different Z value, so the C matrix's each row has identical entries. Then I used surf function to plot.
But when I have the same plot in Mathematica, it gives me something like this:
.
First I used Flatten function to put my 3 matrices into a triple form, then plotted only the upper half of the figure, and realized the upper part of the surface won't close as I expected, I guess this is because for each XY pair, it may have more than one corresponding Z values (since it looks like a sphere), and the sample data points that with closest xy values are connected first. So some of the data points on the top are connected to the lower parts data points whose xy are closer to them, rather than connected to where it should.
Right now I'm using ListPlot3D command. BTW, I got those data by using a outer loop to search the Z values and for each Z value, I used polar coordinates to characterize the contour, then transform it into Cartesian form, so I can't get uniform XY.
I'm wondering if there is any options or way to deal with this situation, or any way to Plot 3 matrices like the surf function in Matlab?
Follow Up 1
Thanks a lot for everyone's answer, I'd like to upload the code, but the code is actually very lengthy, and not possible to copy it in this poster, is there any method to upload the file?
Or to make the long story short, I have a 300 by 3 matrix, i.e. 300 triples as the input of ListPlot3D (or other possible function like the SurfacePlot3D), and the triples hold the values like {{1.234,0,0},{1.200,0.0003,0},{1.150,0.007,0},...,{1.224,-0.003,0},{1.4,0,0.3},{1.340,0.0003,0.3},{1.250,0.007,0.3}...,{1.358,-0.003,0.3},...}, the last value represent Z coordinates Z=z_i, and the first two are obtained by first obtaining the polar coordinates of the data points on the contour Z=z_i, and then transforming them into cartesian coordinates.
Follow Up 2
Thanks a lot for your answers, I realize I could share it with dropbox, here is the link: https://www.dropbox.com/sh/2h722qxalkecupk/AADA6IUiPZA2MD-0cSXx0eiAa?dl=0;
I've tried the commands you guys mentioned in the above file: For the paramterplot3d function from Rahul Narain, it works perfect for my problem, and gave me this figure:
This is exactly how it should be, but looks a bit poor, any idea of improving the quality by eliminating the mesh on the figure and make it smoother if possible?
I also tried the ListSurfacePlot3D function, seems it's also exactly for this application, and quite powerful, but it gives me some result like this:
Any ideas?
And the answer to you mean you are just plotting the surface f(x,y)=c? from Igor Rivin is: not exactly, for I have triples and Z values changes.
Follow Up 3
Hello guys, I've tried your codes, all of them work great!
Problem is more or less solved, but if possible, I'd also like to ask again if anyone can help with the third figure in this thread, to eliminate the grids on the surface? And even better if we can make the surface a little bit smoother? This surface represents the data a bit more precise than the one gained by interpolation, which is obtained by the listParametricPlot3D function. I also have it in my uploaded file. But anyway, the interpolation method also works great, but it's a bit ,thanks a lot! Hello, everyone, problem solved, all of your answers work great, just I can just pick one answer.