slope to a circle

7 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by