Index exceeds the number of array elements (1). Error in HW08_Spaceship (line 34) xT =(5*(cos(4​5)+B(T+Kon​e)*sin(T)/​2+sin(45)+​B*(T+1/Kon​e)*cos(T))​) >>

조회 수: 1 (최근 30일)
R= 40;
Xo= 125;
B = 42;
Kone = 5;
T = 0: 30;
xT =(5*(cos(45)+B(T+Kone)*sin(T)/2+sin(45)+B*(T+1/Kone)*cos(T)))
yT =(5*(sin(45)+B(T+Kone)*sin(T)/2-cos(45)+B*(T+1/Kone)*cos(T)))
plot (xT,yT,'r--')

답변 (1개)

madhan ravi
madhan ravi 2019년 1월 30일
편집: madhan ravi 2019년 1월 30일
Suspect it should be sind() and cosd() ?:
R= 40;
Xo= 125;
B = 42;
Kone = 5;
T = 0:30;
% v-----------------------------v-----missed it
xT =(5*(cos(45)+B*(T+Kone).*sin(T)/2+sin(45)+B*(T+1/Kone).*cos(T)))
% ^---- was the reason for your error
% v-----------------------------v-----missed it
yT =(5*(sin(45)+B*(T+Kone).*sin(T)/2-cos(45)+B*(T+1/Kone).*cos(T)))
% ^---- was the reason for your error
plot (xT,yT,'r--')

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by