
Using cos function in matrix leads to invalid input character
조회 수: 4 (최근 30일)
이전 댓글 표시
I have an unexpecetd error when trying to
>> Rz= [cos(0.2) -sin(0.2) 0; sin(0.2) cos(0.2) 0; 0 0 1]
Rz= [cos(0.2) -sin(0.2) 0; sin(0.2) cos(0.2) 0; 0 0 1]
↑
Error: The input character is not valid in MATLAB statements or
expressions.
댓글 수: 0
답변 (1개)
James Tursa
2016년 6월 20일
편집: James Tursa
2016년 6월 20일
You have special unprintable characters between the "cos" and the "(" characters, and between the "sin" and the "(". You need to delete these. E.g., just copy and paste what you have written above into the MATLAB command line and you will see them as red squares. I am guessing you didn't type this in by hand originally, but copied it from a document or web page and didn't realize those special characters were there.

댓글 수: 2
James Tursa
2016년 6월 22일
편집: James Tursa
2016년 6월 22일
The characters are definitely there. Try typing it in again from scratch. Or just copy and paste this which has those special characters removed:
Rz= [cos(0.2) -sin(0.2) 0; sin(0.2) cos(0.2) 0; 0 0 1]
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!