How do I fix the error "Line 10: Parse error at 2: usage might be invalid MATLAB syntax"?
이전 댓글 표시
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
답변 (2개)
Guillaume
2018년 7월 8일
0 개 추천
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
2018년 7월 8일
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
Heiland
2018년 7월 8일
Guillaume
2018년 7월 8일
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
2018년 7월 8일
Exactly.
What are your data, and what do you want to do with them?
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!