error for incorrect dimensions
조회 수: 11 (최근 30일)
이전 댓글 표시
When I run this script I get an error that says that I have incorrect dimensions for matrix multiplication. I want it to run through all of the values for t and produce a array with the values for v. I have used this same format for similar problems and have never gotten an error.
댓글 수: 0
답변 (1개)
Walter Roberson
2019년 4월 5일
You have something of generally the form exp(t) * cos(t) . That * operation is algebraic matrix multiplication, which can only work if the second dimension of the first argument (so, length(t) in this case) is the same as the first dimension of the second argument (which would be 1 in this case, since cos(t) would be a 1 x something vector.)
You should probably be using .* operator instead of the * operator.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!