フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

can someone tell me whats wrong with my coding?

2 ビュー (過去 30 日間)
eri
eri 2012 年 10 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i make this, and it work just fine clear all clc
load matrix4;
b=a
[x,y]=size (b)
d=999999999999999999999999999999999999999999999999999999999;
for n=1:x
b(n,:) = [ ];
c=det(b*b')
if c<d;
d=c
m=n
end
b=a;
end
small=[d]
row=[m]
but then, when i change the matrix, this message appear
Undefined function or variable 'm'.
Error in mystock (line 18)
row=[m]
can someone help me whats wrong?
  1 件のコメント
Stephen
Stephen 2012 年 10 月 1 日
that error means that the variable 'm' was never created earlier in the code.

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 10 月 1 日
編集済み: Andrei Bobrov 2012 年 10 月 1 日
x =size(a,1);
d=inf;
for n=1:x
k = a([1:n-1,n+1:end],:);
c=det(k*k.')
if c < d;
d = c;
row=n;
end
end
small=d;
or
x = size(a,1);
c = zeros(x,1);
for n=1:x
k = a([1:n-1,n+1:end],:);
c(n) = det(k*k.');
end
[small,row] = min(c);
  2 件のコメント
eri
eri 2012 年 10 月 1 日
what do you mean?
Andrei Bobrov
Andrei Bobrov 2012 年 10 月 1 日
I corrected the your code as you requested.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by