Error using * Incorrect dimensions

조회 수: 2 (최근 30일)
Leia Troop
Leia Troop 2021년 10월 18일
답변: Bjorn Gustavsson 2021년 10월 19일
I am trying to do least squares fitting for a homework assignment
I have included my code and related workspace as an attachment. I am having issues with line 8. I have fiddled with the code but haven't found a solution.
(also I know I don't need the n variable its just there for now)
an explanation of what is wrong and how to solve would be very much appreciated. Thank you!

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2021년 10월 19일
For problems like these you should learn to run the code line-by-line at the command-line prompt. Then check the size and type of the resulting variables, using size(X) and whos X for example. Also check which combinations of transposes makes your multiplications work and what shapes of the matrices are.
HTH

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by