Index exceeds the number of array elements (1).
3 views (last 30 days)
Show older comments
[AVelocity,LVelocity,points,t] = simMechanicsData;
theta1 = linspace(-45, 45, points);
theta2 = linspace(-60, 0, points);
theta3 = linspace(-30, 30, points);
%--------------------------------------------------
% computing angular velocity
% finding thetad using cubic polynomial trajectory function
t0=0;
tf=1;
q01=-45; q02=-60; q03=-30;
qf1=45; qf2=0; qf3=30;
v0=0;
vf=0;
t=linspace(t0,tf,points);
traj1=cubictraj(t0,tf,q01,qf1,v0,vf, points);
theta1d=traj1(1,2);
traj2=cubictraj(t0,tf,q02,qf2,v0,vf, points);
theta2d=traj2(1,2);
traj3=cubictraj(t0,tf,q03,qf3,v0,vf, points);
theta3d=traj3(1,2);
%angular velocity(w)=thetad * k
for t = 1:points
%transformation matrices
H01 = Rz(theta1(t));
H12 = Ry(theta2(t));
%angular velocity
w01=theta1d(t)*[0; 0; 1];
w12=theta2d(t)*(H01(1:3,1:3))*[0; 1; 0];
w23=theta3d(t)*(H12(1:3,1:3))*[0; 1; 0];
w03=w01+w12+w23;
end
function [AVelocity,LVelocity,points,t] = simMechanicsData
% simMechanics Model - EE data taken from professor
eeData=load('EE_DATA.mat');
EE=eeData.ee_data;
%defining variables
LVelocity = EE(5:7,:);
AVelocity = EE(8:10,:);
t = EE(1,:);
points=length(EE);
end
The error comes up at "w01=theta1d(t)*[0; 0; 1];"
1 Comment
Image Analyst
on 3 Mar 2020
What does this show in the command window:
whos points
and isn't
w01=theta1d(t)*[0; 0; 1];
the same as
w01 = [0; 0; theta1d(t)];
Answers (0)
See Also
Categories
Find more on Logical 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!