3D plotting, Vector Length error
Show older comments
Hi,
I am trying to draw a 3d shape, using equations. To do so, I use logical indexing.
I am able to do it in 2D, but not in 3d, I always get the vector length error and I do not understand why. All I am trying to do is to try a straight line from at y=0 from z=-r to z=r. If I can figure out the vector error, I will be able to move on and make more complicated things.
Thanks for your help.
clear all;
clc;
%TJoint Winding w/o radius
%The idea is to experiment with matlab
%Obtains the values
D = 'What is the diameter of the t joint? ';
D = input(D);
l1 = 'What is the length 1 of the t joint? ';
l1 = input(l1);
l2 = 'What is the length 2 of the t joint? ';
l2 = input(l2);
'Thank you, we are now processing the Filament winding of your T-Joint. Please wait ';
%Defining Graph size
x = -D/2:((D/2)+l2);
y = -l1/2 :l1/2;
z = -D/2: D/2;
%Variable Definition
r = D/2;
%Winding step one
x(z >= -r, z <= r ) = r+l2;
y(z >= -r, z <= r )= 0 ;
plot3(x,y,z);
%Axis Labeling
xlabel('X Axis','FontSize',14);
ylabel('Y Axis','FontSize',14);
zlabel('Z Axis','FontSize',14);
title('Tjoint winding w/o radii','FontSize',14);
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!