Differences From Artifact [a05c50834e]:

To Artifact [261e38eb89]:


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  error_old = inf;
  error=1e50;
  theta = theta_0;
  Theta = [];
  Error = [];
  Y = [];
  iterations = 0;
  while (abs(error_old-error)>criterion)&&(iterations<max_iterations)
    iterations = iterations + 1;
    error_old_old = error_old;
    error_old = error;
    eval(sprintf("[t,y,y_theta] = \
	mtt_s%s(system_name,theta,free);",method)); # Simulate system

    if View







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  error_old = inf;
  error=1e50;
  theta = theta_0;
  Theta = [];
  Error = [];
  Y = [];
  iterations = 0;
  while (abs(error_old-error)>criterion)&&(abs(error)>criterion)&&(iterations<max_iterations)
    iterations = iterations + 1;
    error_old_old = error_old;
    error_old = error;
    eval(sprintf("[t,y,y_theta] = \
	mtt_s%s(system_name,theta,free);",method)); # Simulate system

    if View
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
    if error<(error_old+criterion) # Save some diagnostics
      Error = [Error error];	# Save error
      Theta = [Theta theta];	# Save parameters
      Y = [Y y];		# Save output
    endif

    ## Update the estimate if we are not done yet.
    if (abs(error_old-error)>criterion)&&(iterations<max_iterations)
      if error>(error_old+criterion) # Reduce step size and try again
        factor = 10;
	disp(sprintf("%2.2f*step",alpha));
	error = error_old;	# Go back to previous error value
	error_old = inf;	# Don't let it think its converged
	theta(free) = theta(free)  + step; # Reverse step
	step = alpha*step;	# new stepsize







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
    if error<(error_old+criterion) # Save some diagnostics
      Error = [Error error];	# Save error
      Theta = [Theta theta];	# Save parameters
      Y = [Y y];		# Save output
    endif

    ## Update the estimate if we are not done yet.
    if (abs(error_old-error)>criterion)&&(abs(error)>criterion)&&(iterations<max_iterations)
      if error>(error_old+criterion) # Reduce step size and try again
        factor = 10;
	disp(sprintf("%2.2f*step",alpha));
	error = error_old;	# Go back to previous error value
	error_old = inf;	# Don't let it think its converged
	theta(free) = theta(free)  + step; # Reverse step
	step = alpha*step;	# new stepsize

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]