slope to a circle

조회 수: 1 (최근 30일)
reza
reza 2014년 1월 2일
편집: Image Analyst 2014년 1월 2일
hi, how can i give slope two a circle using the code below,
if true
% code
r=1
teta=-pi:0.01:pi
x=r*cos(teta);
y=r*sin(teta);
z=zeros(1,numel(x));
plot3(x,y,z);
hold on
end
  댓글 수: 1
Image Analyst
Image Analyst 2014년 1월 2일
What do you mean by slope? Do you mean that you don't want the z values to all be the same so that it is parallel with the x-y plane? That you want the circle tilted/slanted so that it has a variety of z values?

댓글을 달려면 로그인하십시오.

답변 (2개)

cr
cr 2014년 1월 2일
편집: cr 2014년 1월 2일
For you. Cheers.
function coordinates = arc(C,R,inplane,normal,t)
% ARC function generates coordinates to draw a circular arc in 3D
% arc(C,R,inplane,normal,t)
% R - Radius
% C - Centre
% inplane - A vector in plane of the circle
% normal - A vector normal to the plane of the circle
% t - vector of theta. E.g. for a full circle this is 0:0.01:2*pi
% By Chandrakanth R.Terupally
v = cross(normal,inplane);
coordinates = [C(1) + R*cos(t)*inplane(1) + R*sin(t)*v(1);
C(2) + R*cos(t)*inplane(2) + R*sin(t)*v(2);
C(3) + R*cos(t)*inplane(3) + R*sin(t)*v(3)];
end

Image Analyst
Image Analyst 2014년 1월 2일
편집: Image Analyst 2014년 1월 2일
Try this:
fontSize = 20;
r=1;
theta = linspace(-pi, pi, 90);
x = r * cos(theta);
y = r * sin(theta);
tiltFactor = 1.0;
z = tiltFactor * x;
plot3(x,y,z, 'bo-', 'LineWidth', 2);
hold on
grid on
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by