Please i will be greatful if anyone can just edit the code to help me achieve my aim thanks in anticipation
How can i get the index of the submatrix D, that correspond to the maximum determinant?
2 views (last 30 days)
Show older comments
I have this code
A= randn(2, 4);%this will give me a 2rows by 4columns matrix
b=0;
for i=1:1:4
for j=(i+1):1:4
b=b+1;
D=[A(:,i),A(:,j)];
E(b)=det(D);
end
end
F=max(E);
From the code a submatrix D is designed for each iteration F will return the maximum determinant after all itereations. But please, how can i get the index [i ; j] that made up the matrix D which correspond to F
Accepted Answer
Roger Stafford
on 5 Oct 2014
A = randn(2,4);%this will give me a 2rows by 4columns matrix
b = 0;
for i=1:1:4
for j=(i+1):1:4
b=b+1;
D=[A(:,i),A(:,j)];
E(b)=det(D);
G(b,:) = [i,j]; % <---
end
end
[F,b] = max(E); % <---
[i,j] = G(b,:); % <---
3 Comments
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!