Index exceeds the number of array elements (1).

조회 수: 3 (최근 30일)
Tina Barsoumian
Tina Barsoumian 2020년 3월 3일
댓글: Image Analyst 2020년 3월 3일
[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
Image Analyst
Image Analyst 2020년 3월 3일
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)];

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by