Kristin
Posts:
69
Registered:
2/22/12


Re: Error using plot Vectors must be the same lengths.
Posted:
Mar 19, 2013 7:16 PM


"Chris " <ccimine00@ccny.cuny.edu> wrote in message <khi704$cp6$1@newscl01ah.mathworks.com>... > So I am somewhat new to matlab and am getting this error when i run this code: Error using plot Vectors must be the same lengths. I believe everything in my code is correct just it wont run. PLEASE HELP! > > clf > close all > > s=0:0.1:6; > L=8.4; > P=800; > B=[P*cosd(20); P*sind(20); 0]; > > for i=1:length(s) > x(i)=(L^249+(14*s(i)))/(2*L); > y(i)=sqrt(x(i)^2s(i)^2); > A1=[ 1, 0, (((7s(i))/(Lx(i)))(s(i)/x(i)))]; > A2=[ 0, 1, ((y(i)/(Lx(i)))+(y(i)/x(i)))]; > A3=[ 5.1, 3.5, ((7*y(i))/x(i))]; > A=[ A1; A2; A3]; > T(:,i)=A\B; > end > > figure > plot(s,T(1,:),s,T(2,:),s,T(3,:),'LineWidth',1) > xlabel('s[Meters]','FontSize',16) > ylabel('Tension[Newtons]','FontSize',16) > title('Tension in the rope as a function of s','FontSize',16)
>> help plot
PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by the (X,Y,S) triples, where the X's and Y's are vectors or matrices and the S's are strings.

