How do i fix the error that i am getting?

조회 수: 2 (최근 30일)
Taylor
Taylor 2023년 7월 13일
댓글: Torsten 2023년 7월 13일
My code is
A = [1,1,0,2,0;0,1,1,3,0;2,0,0,0,1;3,1,0,2,1;2,1,1,3,0;1,0,0,2,1]
rrefA = rref(A)
basisRowSpace = A(rrefA(:,end)~=0,:)
pivotColumns = rrefA(:,1:end-1)
basisColumnSpace = A(:,pivotColumns)
This is where it stops working and I dont know how to fix it.
The error that I get is Index in postion 2 is invails. Array indices must be postive integers or logical values.
I would appricate any help to be able to fix this and get it to run.
Thank You.

채택된 답변

Torsten
Torsten 2023년 7월 13일
이동: Torsten 2023년 7월 13일
Remove the semicolon behind the line
pivotColumns = rrefA(:,1:end-1);
execute the code and see if it makes sense to insert the displayed matrix in
basisColumnSpace = A(:,pivotColumns);
  댓글 수: 7
Taylor
Taylor 2023년 7월 13일
I am supposed to be finding the basis for column space.
Torsten
Torsten 2023년 7월 13일
Ok, that's what "licols" does. The maximum number of independent columns of A is a basis for the column space of A.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by