Azzera filtri
Azzera filtri

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 visualizzazione (ultimi 30 giorni)
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--')

Risposte (1)

madhan ravi
madhan ravi il 30 Gen 2019
Modificato: madhan ravi il 30 Gen 2019
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--')

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by