Matlab error, pleaseㅠ E Error using ==> plot Vectors must be the same lengths.

Asked 1 years ago, Updated 1 years ago, 90 views

```q0=input('initial angle='); qf=input('final angle='); tf=input('final time='); a=input('Desired Acceleration='); tb=tf/2-(sqrt(a2*tf2-4*a*(qf-q0)))/(2*a); V=a*tb; t1=[0:0.01:tb]; q1=q0+V/(2*tb)*t1.2; dq1=a*t1; ddq1=a*ones(1,length(t1)); t2=[tb+0.01:0.01:tf-tb]; q2=(qf+q0-V*tf)/2+V*t2; dq2=V*ones(1,length(t2)); ddq2=0*ones(1,length(t2)); t3=[tf-tb+0.01:0.01:tf]; q3=qf-a/2*tf2+a*tf*t3-a/2*t3.2; dq3=a*tf-a*t3; ddq3=-a*ones(1,length(t3)); t=[t1 t2 t2]; q=[q1 q2 q3]; dq=[dq1 dq2 dq3]; ddq=[ddq1 ddq2 ddq3]; subplot(311) plot(t,q); title('LSBP route planning'); ylabel('position q(t')); subplot(312) plot(t,dq); ylabel('speed dq(t')); subplot(313) plot(t,ddq); ylabel('acceleration ddq(t')); xlabel('time in seconds');

2*tf2-4*a*(qf-q0)))/(2*a);2-4*a*(qf-q0)))/(2*a);2;2+a*tf*t3-a/2*t3.2;2;

I wrote a code to plot the graph with Matlap, but I keep getting errorscrying
What's the problem? If you know the initial and later angles of the robot and the time and acceleration it took,
This is a graph that shows how each link in the robot works!
What's the problem? I really need your help Please!

matlab plot

2022-09-22 21:56

1 Answers

What purpose did you write the variable t?

Now t is the structure of a vector in a vector, and it seems that each vector in the vector must have the same number of elements.

If the lengths of t1, t2, and t3 are different from each other in terms of values,

First, draw the t1, q1 set, t2, q2 set, t3, q3 set.


2022-09-22 21:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.