How do I fix the error "Line 10: Parse error at 2: usage might be invalid MATLAB syntax"?
Show older comments
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
Answers (2)
Guillaume
on 8 Jul 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
on 8 Jul 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 Comments
Heiland
on 8 Jul 2018
Guillaume
on 8 Jul 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
on 8 Jul 2018
Exactly.
What are your data, and what do you want to do with them?
Categories
Find more on Install Products 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!