How can I fix this error - "Error using * Inner matrix dimensions must agree"
이전 댓글 표시
I am trying to obtain values for hm and hd with the range numbers I selected. I get an error when trying to do this however. Is there a way I can fix this? Thank you for your help.
답변 (2개)
Rik
2018년 6월 10일
1 개 추천
If you want to do an element-wise calculation, you should use .* instead of *. Otherwise, Matlab assumes you want to do a matrix-multiplication. The same goes for divisions. If you had posted your code in the question (and used the {}Code button for proper layout), I could have put the corrected code here for you.
Ameer Hamza
2018년 6월 10일
when you want element-wise multiplication or division between two vectors then use .* or ./ respectively. Therefore change the line as follow
hm = dtc - 1.4 + (1.5-b-1.5*tan(theta)).*sin(theta) + 1.5./cos(theta);
카테고리
도움말 센터 및 File Exchange에서 Elementary Math에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!