Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

can someone tell me whats wrong with my coding?

2 visualizaciones (últimos 30 días)
eri
eri el 1 de Oct. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Stephen
Stephen el 1 de Oct. de 2012
that error means that the variable 'm' was never created earlier in the code.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 1 de Oct. de 2012
Editada: Andrei Bobrov el 1 de Oct. de 2012
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 comentarios
eri
eri el 1 de Oct. de 2012
what do you mean?
Andrei Bobrov
Andrei Bobrov el 1 de Oct. de 2012
I corrected the your code as you requested.

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by