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
);
Related
I wanted to change the position of z-axis in a 3d graph. I tried to do using graph properties but it does not work, Matlab has this option in 2D plot in axis properties window in the graph, but it does not work in 3d plots. Currently,the plot is at z=0 and I wanted to the position to z=6. Attached is the sketch where I need to change the position of the curve plot (red) from z=0 to z6. I appreciate if there is any solution/suggestion regarding this issue. Thank you.
sketch
Regards,
Alishah
A very simple solution for this question is that convert z in your formula to z-6. You know it from mathematics, It will shift a curve, 6 unit .
If you want to change in right or left, you plus or minus.
I have a 3D plot and I want to put a sphere in a designed position. How can I create a sphere? I expected to use patch? Can anyone help me to do this please?
You can follow this:
Consider the center is at [c1,c2,c3]. The number of faces as r.
[x,y,z] = sphere(r);
surf(x+c1, y+c2, z+c3)
These two lines of code are enough to plot a sphere using the surf command.
For instance, if C=[2,2,2] and r=30 the result is as follows:
This is a sphere of radius 1 centered at [2,2,2]. To have a sphere with an arbitrary radius R, you should multiply the [x,y,z] values by R before adding the center.
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
In matlab I need to create a mesh (surf) of a function.
then I need to show the mesh contour lines.
in the end I need to show with arrows the contour lines direction.
I have this so far:
mesh(T); //T is the matrix [150x200] created by the function, this present me the mesh
contour(T);//this present me the contour lines
[px py]=gradient(T);//this for calculate gradient of T (px is[150x200] and also py)
contour(T), hold on, quiver(px,py), hold off //quiver is to make arrows
This work fine, I can see the contour lines but my problem is that the arrows are too crowded and what i'm seeing it not very clear.
I need to diluted px and py but I don't know how.
I don't know if it is something I need to do before the gradient function or after.
I need that px and py will stay on [150x200] and maybe replace some value in them to zero,
Thank you all!
I'd "dilute" the arrow, (px,py) by sampling just a subset of them. For example:
N=25; % or usea different # of points if needed
range1=unique(round(linspace(1,size(T,1),N)));
range2=unique(round(linspace(1,size(T,1),N)));
[rx ry]=meshgrid(range1,range2);
quiver(rx,ry,px(range1,range2),py(range1,range2)); %, hold off
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.