no puedo plotear en mi codigo

4 views (last 30 days)
Ricardo David
Ricardo David on 30 Oct 2022
Answered: Gokul Nath S J on 26 May 2023
%R1=3;% radio de las bandas
bi=1; %espaciado;
%elipse externa
a=[3*cos(tr) 3*cos(tr1)];
b=[3*sin(tr) 3*sin(tr1)-6];
a1=[2*cos(tr) 2*cos(tr1)];
b1=[2*sin(tr) 2*sin(tr1)-6];
% la separacion para cada banda es = b
c=[c+14 c+13 c+12 c+11 c+10 c+9 c+8 c+7 c+6 c+5 c+4 c+3 c+2 c+1];
tr2= linspace(0,pi,100); tr22=linspace(pi,2*pi,100); tr23=linspace(0,pi,100);
a2=[3*cos(tr2) 3*cos(tr22)];
b2=[3*sin(tr2) 3*sin(tr22)-4];
a3=[2*cos(tr2) 2*cos(tr22)];
b3=[2*sin(tr2) 2*sin(tr22)-6];
%separacion es de 2
c1=[c1+0 c1+2 c1+4 c1+6 c1+8 c1+10 c1+12 c1+14];
for i=1:3
a=[a a];
b=[b b];
a1=[a1 a1];
b1=[b1 b1];
a2=[a2 a2];
b2=[b2 b2];
a3=[a3 a3];
b3=[b3 b3];
%linea cruzada
tz=linspace (0,pi/4,100);
a4=[3*cos(tz) cos(3*pi/2)-tz1];
b4=[3*sin(tz)-6 sin((3*pi/2)-tz1)];
a5=[cos(tz) 3*cos((3*pi/2)-tz1)];
b5=[sin(tz)-6 3*sin((3*pi/2)-tz1)];
Error using plot3
Vectors must be the same length.
hold on
hold on
xlim([-3 3]);
xlabel('axis x')
ylabel('axis y')
zlabel('axis z')
title('banda transportadora')
hold off
  1 Comment
Jan on 30 Oct 2022
I've included the error message in the question. It is easier to solve a problem than to guess, what the problem is.

Sign in to comment.

Answers (1)

Gokul Nath S J
Gokul Nath S J on 26 May 2023
Hi Ricardo,
It seems that you are receving an error mentioning the vectors are of different length. The variable c1 is of length 800 while the other variables a2 and b2 are 1600. Please note that this difference is attributed to the fact that you are concatinating two matrixes together in the following lines.
a2=[3*cos(tr2) 3*cos(tr22)];
b2=[3*sin(tr2) 3*sin(tr22)-4];
Since the objective of the function is not mentioned in the question, as I workaround, I would suggest you check the dimension of the a2, b2 and c1 variable and understand whether there is a requirement for the concatenation or you might have missed the concatination of the variable c1.
with regards,
Gokul Nath S J


Find more on MATLAB Report Generator 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!