row by row minimization
Mostrar comentarios más antiguos
Hello,
I am relatively new to programing. I have written the following function to be optimized by another MATLAB function that I found online:
function z = PSO_inv(x)
DM=dlmread('DM.dat','\t',1,0);
mp=length(DM);
for i=1:mp
DC(i,:)=forward_p(x);
end
t=0;
for k=1:4
for i=1:mp
t = t + (((DM(i,k)-DC(i,k))/DM(i,k))^2);
end
end
z=100*sqrt(t/4);
end
I have two matrices DM and DC, both are 206x4, and would like to minimize the difference row by row, but I think my code now tries to do the optimization for the whole dataset at once.
Thank you, any help is appreciated!
2 comentarios
Jan
el 20 de Feb. de 2018
What is "forward_p"? What is "x" and the contents of "DM"? What exactly does "minimize the difference row by row" mean?
Respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!