Filter löschen
Filter löschen

slope to a circle

5 Ansichten (letzte 30 Tage)
reza
reza am 2 Jan. 2014
Bearbeitet: Image Analyst am 2 Jan. 2014
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 Kommentar
Image Analyst
Image Analyst am 2 Jan. 2014
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?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

cr
cr am 2 Jan. 2014
Bearbeitet: cr am 2 Jan. 2014
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 am 2 Jan. 2014
Bearbeitet: Image Analyst am 2 Jan. 2014
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]);

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by