How do I fix the error "Line 10: Parse error at 2: usage might be invalid MATLAB syntax"?
Afficher commentaires plus anciens
clc
Vb=[0 -12];
Va=(-18*cosd(60)-18*sind(60));
Vba=Vb-Va;
magnitude_Vba=norm(Vba);
Angle_Vba=atand(Vba(2)/Vba(1));
Abnormal=Vb(2)^2/100;
Ab=(-Abnormal-3);
Aa=2*cosd(60) 2*sind(60);--- this line is getting the error
Aba=Ab-Aa;
magnitude_Aba=norm(Aba);
Angle_Aba=atand(Aba(2)/Aba(1));
%Display
Réponses (2)
Guillaume
le 8 Juil 2018
0 votes
What is unclear about the error message? Clearly you're missing something between 2*cosd(60) and 2*sind(60), perhaps an operator. As it is, yes the line does not make sense.
Star Strider
le 8 Juil 2018
You either need an arithmetic operator (addition, subtraction, muyltiplication, division or the element-wise vectorized versions of them) or create ‘Aa’ as a matrix.
Assuming you want it as a matrix, this will work:
Aa = [2*cosd(60) 2*sind(60)]; % --- this line is getting the error
and will work with the rest of your code (producing Angle_Aba=48.6), although I have no idea what you actually want to do.
3 commentaires
Heiland
le 8 Juil 2018
Guillaume
le 8 Juil 2018
Well, yes, since Aba has only one element, Aba(2) doesn't exist.
Clearly, you've made another mistake. Perhaps you should proofread your code.
Star Strider
le 8 Juil 2018
Exactly.
What are your data, and what do you want to do with them?
Catégories
En savoir plus sur Install Products dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!