I have 5 variables, say l1,l2,g1,g2,g3. I want to optimize the gi (i=1,2,3) inside the two loops of l1 and l2 i.e. for each combination of l1 and l2, I want an optimal set of g_i for which the computed value should show a maximum and so on for the next values of l1 and l2. I don't have any tool box for this and I want to optimize without those.
fid = fopen( sprintf(...
x2=[x2;g2 g3 maxen];
fprintf(fid,'%f %f %f %f %f\t %f %f \r\n',l1,l2,g1,x3,x4,x5,maxen);
I tried for a simple case for fixed l2 and fixed g1 but the result of maxen and x5 doesnt match while writing x2= outside g2 to get proper indices of g2 and g3 for that maximum value of maxen (writing in the .dat file). However, if write x2= inside g2, I lost the precise value of g2 as it shows end values only but with optimal g3 and equal maxen and x5 there. How can I optimize gi and find this optimal set there for maximum of maxen for each value of two outer loops (l1,l2)?.
if optimization is not possible with this way, do I need to use any algorithms for this?
Please suggest other alternates for the same.