Im using the equation from here to draw a torus. My c=3.7 and a=0.5. I've played a lot with these values but always getting a rather misshapen torus (way too tall).
Matlab command:
ezmesh('(3.7+0.5*cos(v))*cos(u)','(3.7+ 0.5*cos(v))*sin(u)','0.5*sin(v)',[0,2*pi,0,2*pi])
And a screenshot of what im getting.
How can I tweak it so it looks like a "nice" donut?? Is there a problem with the equation itself ?
As Dan suggested, the torus looks right, but if you check to the X,Y,ans Z axis you can notice that you dont have them in the same scale. Axis equal will make the scale to be equal in all the coordinates
Related
I want to plot cylinder contained between planes z=x+1/2 and z= -x-1/2.This cylinder should have radius equal to one.
I tried to find something in maple help. But my work was done at this moment :
enter image description here
So as you see, i get my cylinder with the radius 1 but I dont know how to make this contained between planes z=x+1/2 and z= -x-1/2.
Can you please help me ?
I don't understand what you mean by, "contained between planes z=x+1/2 and z=-x-1/2".
Do you mean between x+1/2 and x-1/2?
restart;
C:=plots:-cylinderplot(0.5,theta=0..2*Pi,z=0.5..0.5+1/sqrt(2),
style=surface):
rotC:=plottools:-rotate(C,-3*Pi/4,[[0,0.5,0.5],[0,-0.5,0.5]]):
plots:-display(
rotC,
plot3d([x-1/2,x+1/2],x=-0.5..1,y=-0.75..0.75,
style=surface,color=gray,transparency=0.5),
scaling=constrained, view=-0.5..1
);
I would like to find residuals of my solutions. However, each solution uses a different grid, thus I would like to interpolate the solutions in 2D to a mesh grid for each solution such that I can easily find the residuals.
I used griddata which seems to work, but it doesn't work very well in regions of discontinuities and near edges. I would like to interpolate data of flow over a sphere for example. The area of the sphere should be confined to zero since that is outside of the grid boundaries; however, after using griddata, there's some non zero values in the sphere region. I also get a warning saying there were duplicate x and y points.
Does anyone know how to preserve the integrity of the sphere after using griddata? I've double checked the original x,y data, and the area of the sphere all have values of 0.
Thank you. I hope that made sense.
Best,
Yuki
So I have a 3 dimensional matrix of points that (presumably) define a surface. For my purposes, X and Y can be random values but when plotted along with their Z coordinates, they will define some undulating surface. I'd like to measure the local curvatures of said surface, and in order to do that, I need to be able to find the gradient of said surface, at which point calculating the curvature is trivial.
I have not yet found an implementation of how to measure this curvature that doesn't make use of Matlab's gradient function. The problem with Matlab's gradient function is that it assumes that the points are in some sort of order, similar to diff(X). This would suffice if my points were spaced along a grid, which is not necessarily the case.
One possible solution to measuring the gradient is to give in and assign each point to a discrete coordinate in a grid in the XY plane, thus overcoming this issue. However, this solution seems somewhat inelegant and was curious to see if anyone had suggestions. Thanks!
You can use griddata to interpolate from your scattered data points to grid spaced points and then calculate the gradient.
I'm trying to plot just one point in any coordinate system: Cartesian, cylindrical or spherical.
I tried plot3(1,1,1) with many values but just shows a tiny point in the same location for all values! I tried surf(X,Y,Z) as well but matlab said: Z must be a matrix, not a scalar or vector.
How about this?
plot3(1,1,1,'.');
grid on
You did try it, but then again, that is exactly what it does!
Something like
scatter3(x,y,z1,720,'g','fill')
will make opaque green spheres of 720 size around all the points listed in the vectors x,y,z1.
I have a 3D data set of a surface that is not a function graph. The data is just a bunch of points in 3D, and the only thing I could think of was to try scatter3 in Matlab. Surf will not work since the surface is not a function graph.
Using scatter3 gave a not so ideal result since there is no perspective/shading of any sort.
Any thoughts? It does not have to be Matlab, but that is my go-to source for plotting.
To get an idea of the type of surface I have, consider the four images:
The first is a 3D contour plot, the second is a slice in a plane {z = 1.8} of the contour. My goal is to pick up all the red areas. I have a method to do this for each slice {z = k}. This is the 3rd plot, and I like what I see here a lot.
Iterating this over z give will give a surface, which is the 4th plot, which is a bit noisy (though I have ideas to reduce the noise...). If I plot just the black surface using scatter3 without the contour all I get is a black indistinguishable blob, but for every slice I get a smooth curve, and I have noticed that the curves vary pretty smoothly when I adjust z.
Some fine-tuning will give a much better 4th plot, but still, even if I get the 4th plot to have no noise at all, the result using scatter3 will be a black incomprehensible blob when plotted alone and not on top of the 3D contour. I would like to get a nice picture of the full surface that is not plotted on top of the 3D contour plot
In fact, just to compare and show how bad scatter3 is for surfaces, even if you had exact points on a sphere and used scatter3 the result would be a black blob, and wouldn't even look like a sphere
Can POV-Ray handle this? I've never used it...
If you have a triangulation of your points, you could consider using the trisurf function. I have used that before to generate closed surfaces that have no boundary (such as polyhedra and spheres). The downside is that you have to generate a triangulation of your points. This may not be ideal to your needs but it definitely an option.
EDIT: As #High Performance Mark suggests, you could try using delaunay to generate a triangulation in Matlab
just wanted to follow up on this question. A quick nice way to do this in Matlab is the following:
Consider the function d(x, y, z) defined as the minimum distance from (x, y, z) to your data set. Make sure d(x, y, z) is defined on some grid that contains the data set you're trying to plot.
Then use isosurface to plot a (some) countour(s) of d(x, y, z). For me plotting the contour 0.1 of d(x, y ,z) was enough: Matlab will plot a nice looking surface of all points within a distance 0.1 of the data set with good lighting and all.
In povray, a blob object could be used to display a very dense collection of points, if you make them centers of spheres.
http://www.povray.org/documentation/view/3.6.1/71/
If you want to be able to make slices of "space" and have them colored as per your data, then maybe the object pattern (based on a #declared blob object) might do the trick.
Povray also has a way to work with df3 files, which I've never worked with, but this user appears to have done something similar to your visualization.
http://paulbourke.net/miscellaneous/df3/