Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 09d62fb5741a1ef277e38f23d8920b9d22cd63418a576db34e2fe9520cb34a69
User & Date: gawthrop@users.sourceforge.net on 1999-10-15 07:34:23
Other Links: branch diff | manifest | tags
Context
1999-10-18
04:08:46
Now computes n_vector_bonds -- number apparent (maybe vector) bonds per component.
Neeeded to vectorise junctions.
check-in: a4fc0123b6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-10-15
07:34:23
Initial revision check-in: 09d62fb574 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-10-13
07:01:58
Added aliases:
%ALIAS a_in theta_in
%ALIAS a_out theta_out
check-in: e7dfdfa5c1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/m/mtt_optimise.m version [c64ac34ead].









































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [theta,Theta,Error,Y,iterations] = mtt_optimise (system_name,y_s,theta_0,method,free,weight,criterion,max_iterations,alpha)
  ## Usage: [theta,Theta,Error,Y,iterations] = mtt_optimise (system_name,y_s,theta_0,method,free,weight,criterion,max_iterations,alpha)
  ##  system_name     String containg system name
  ##  y_s   actual system output
  ##  theta_0   initial parameter estimate
  ##  free  Indices of the free parameters within theta_0
  ##  weight Weighting function - same dimension as y_s
  ##  method "time" or "freq"
  ##  criterion convergence criterion
  ##  max_iterations limit to number of iterations
  ##  alpha  Optimisation gain parameter

  ## Copyright (C) 1999 by Peter J. Gawthrop

  if nargin<4
    method="time";
  endif

  N = length(theta_0);
  if nargin<5
    free = [1:N];
  endif
  
  if nargin<6
    weight = ones(size(y_s));
  endif

  if nargin<7
    criterion = 1e-5;
  endif
  
  if nargin <8
    max_iterations = 10;
  endif

  if nargin<9
    alpha = 1.0;
  endif
  
  if (!strcmp(method,"time"))&&(!strcmp(method,"freq"))
    error("method must be either time or freq")
  endif
  
  N_theta = length(free);
  Weight = weight*ones(1,N_theta); # Sensitivity weight
  e_last = 1e20;
  error=1e10;
  theta = theta_0;
  Theta = [];
  Error = [];
  Y = [];
  iterations = -1;
  while (abs(e_last-error)>criterion)&&(iterations<max_iterations)
    iterations = iterations + 1;
    e_last = error;
    eval(sprintf("[t,y,y_theta] = mtt_s%s(system_name,theta,free);",method)); # Simulate system
    Theta = [Theta theta];	# Save parameters
    Y = [Y y];			# Save output
    E = weight.*(y - y_s);	# Weighted error
    y_theta = Weight.*y_theta;	# Weighted sensitivity
    error = (E'*E);		# Sum the error
    Error = [Error error];
    ##    theta(free) = theta(free) - alpha*(real(y_theta'*y_theta)\real(y_theta'*E));
    tol = 1e-4;
    JJ = real(y_theta'*y_theta);
    ## sigma = svd(JJ)
    theta(free) = theta(free) - alpha*( pinv(JJ,tol)*real(y_theta'*E) );
  endwhile

endfunction



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