How to Find the Determinant of a Matrix in MATLAB using for loop. i don't want to use the actual code.

조회 수: 13 (최근 30일)
How to Find the Determinant of a Matrix in MATLAB using for loop. i don't want to use the actual code.thanks
  댓글 수: 6
maede mandi
maede mandi 2021년 10월 10일
Thanks, bust still I don’t get it how it’s work In a for loop in matlab.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 10월 10일
편집: Walter Roberson 2021년 10월 10일
if isscalar(YourArray) || isempty(YourArray)
total = YourArray;
else
total = 0;
for R = 1 : number_of_rows
for C = 1 : number_of_columns
total = total + SomeValue * YourArray(R,C) * YourDeterminentFunction(YourArray with Row #R and Column #C crossed out)
end
end
end
SomeValue is +1 or -1 but you need to figure out which.
  댓글 수: 2
maede mandi
maede mandi 2021년 10월 10일
편집: Walter Roberson 2021년 10월 10일
clc
close all
a=[1 2 3 ; 4 5 6 ; 7 8 9 ]
%size:number of rows & cloumns
[m1, n1]=size(a);
%for loops
for i=1:m1
% i run upto number of rows in x
for j=1:n1
%j run upto number of columns in x
z(i,j)= (-1)^(1+i)* a [1,j] *... ???????????
end
end
disp('output matrix');
disp(z)
Walter Roberson
Walter Roberson 2021년 10월 10일
Use a recursive function.
z(i,j)
Determinents and cofactors are scalar. What is your reasoning for storing something there?
(There are reasons to want to store items as you go through, but I suspect your thoughts are about something else completely.)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by