row by row minimization
Show older comments
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 Comments
Jan
on 20 Feb 2018
What is "forward_p"? What is "x" and the contents of "DM"? What exactly does "minimize the difference row by row" mean?
Answers (0)
Categories
Find more on Loops and Conditional Statements 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!