source: issm/trunk/src/m/solutions/controlconvergence.m@ 4537

Last change on this file since 4537 was 4537, checked in by seroussi, 15 years ago

keep working on control serial

File size: 953 bytes
Line 
1function convergence=controlconvergence(J,fit,eps_cm,n)
2%CONTROLCONVERGENCE - determine the convergence of control_core solution
3%
4% Usage:
5% converged=controlconvergence(J,fit,eps_cm,n);
6
7 convergence=0;
8 if ~isnan(eps_cm),
9 i=n-2;
10 %go through the previous misfits(starting from n-2)
11 while (i>=1),
12 if (fit(i)==fit(n)),
13 %convergence test only if we have the same misfits
14 if ((c(i).J-c(n).J)/c(n).J <= eps_cm),
15 %convergence if convergence criteria fullfilled
16 convergence=1;
17 displaystring(verbose,'\n%s%g%s%g\n',' Convergence criterion: dJ/J = ',(c(i).J-c(n).J)/c(n).J,'<',eps_cm);
18 else
19 displaystring(verbose,'\n%s%g%s%g\n',' Convergence criterion: dJ/J = ',(c(i).J-c(n).J)/c(n).J,'>',eps_cm);
20 end
21 break;
22 end
23 i=i-1;
24 end
25 end
26
27end %end function
Note: See TracBrowser for help on using the repository browser.