Borrar filtros
Borrar filtros

can not get the answer

1 visualización (últimos 30 días)
sss dzu
sss dzu el 12 de Oct. de 2012
Could anyone help me with this problem? I can not get the same answer with the book. It should be =147.2551. This is I got so far
V=[3 7 4 5 2 6];
x=[1 7 8 17 22 27];
y=[28 18 16 2 10 8];
for i=1:30;
for j=1:30;
for k=1:6;
d(k)= sqrt((x(k)-i).^2+(y(k)-j).^2);
cost(k)=.5.*d(k).*V(k);
c(i,j)=sum(cost(k));
f=min(c(i,j));
end
end
end
  3 comentarios
sss dzu
sss dzu el 12 de Oct. de 2012
You did the same thing i did, not work
Walter Roberson
Walter Roberson el 13 de Oct. de 2012
Please read the guide to tags and retag this question; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 12 de Oct. de 2012
Editada: Azzi Abdelmalek el 12 de Oct. de 2012
V=[3 7 4 5 2 6];
x=[1 7 8 17 22 27];
y=[28 18 16 2 10 8];
for i=1:30
for j=1:30
c(i,j)=0; % modification 1
for k=1:6
d(k)= sqrt((x(k)-i).^2+(y(k)-j).^2);
cost(k)=.5.*d(k).*V(k);
c(i,j)=c(i,j)+cost(k); %modification 2
end
end
end
f=min(c(:)) % modification 3
  6 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 13 de Oct. de 2012
dzu format your code (look at Walter's link)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Downloads en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by