How do I fix the error "Line 10: Parse error at 2: usage might be invalid MATLAB syntax"?

1 view (last 30 days)
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
Guillaume on 8 Jul 2018
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
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
Guillaume
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.

Sign in to comment.

Categories

Find more on Install Products in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!