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

Last change on this file since 6321 was 6321, checked in by Mathieu Morlighem, 14 years ago

Moved displaystring to issmprintf (like in C)
synchronized enums
renamed some Verbose routines

File size: 954 bytes
Line 
1function convergence=controlconvergence(J,responses,eps_cm,n)
2%CONTROLCONVERGENCE - determine the convergence of control_core solution
3%
4% Usage:
5% converged=controlconvergence(J,responses,eps_cm,n);
6
7 convergence=false;
8 if ~isnan(eps_cm),
9 i=n-2;
10 %go through the previous responsess(starting from n-2)
11 while (i>=1),
12 if (strcmp(responses(i),responses(n))),
13 %convergence test only if we have the same misfits
14 if ((J(i)-J(n))/J(n) <= eps_cm),
15 %convergence if convergence criteria fullfilled
16 convergence=true;
17 issmprintf('\n%s%g%s%g\n',' Convergence criterion: dJ/J = ',(J(i)-J(n))/J(n),'<',eps_cm);
18 else
19 issmprintf('\n%s%g%s%g\n',' Convergence criterion: dJ/J = ',(J(i)-J(n))/J(n),'>',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.