KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gordon66SarcoForceLength.m
Go to the documentation of this file.
1 namespace models{
2 namespace muscle{
3 namespace functions{
4 
5 
6 /* (Autoinserted by mtoc++)
7  * This source code has been filtered by the mtoc++ executable,
8  * which generates code that can be processed by the doxygen documentation tool.
9  *
10  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
11  * Except for the comments, the function bodies of your M-file functions are untouched.
12  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
13  * attached source files that are highly readable by humans.
14  *
15  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
16  * the correct locations in the source code browser.
17  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
18  */
19 
28  private:
29 
30  l0;
31 
32  cdata;
33 
34 
35  public:
36 
38  if nargin < 1
39  l0 = 2.05;
40  end
41 
42  /* Data from Paper Gordon1966 */
43  dopt_tab = [1.98 97.09; 2.03 98.6; 2.08 99.87; 2.13 100; 2.18 100.09; 2.23 98.85; 2.28 97.06];
44  /* Roughly "estimated" */
45  dup = [1.3 7; 1.4 25; 1.45 35; 1.5 49; 1.6 68; 1.65 78; 1.7 85; 1.75 88; 1.8 91; 1.9 95];
46  ddow = [2.3 96.6; 2.8 60; 3.0 45; 3.4 20; 3.6 6];
47  curve = [dup; dopt_tab; ddow];
48 
49  /* Sort
50  *[~, idx] = sort(curve(:,1));
51  *curve = curve(:,idx); */
52 
53  /* Normalize */
54  curve(:,2) = curve(:,2)/max(curve(:,2));
55 
56  /* Pad zeros */
57  curve = [1.1 0; 1.25 0; curve; 3.7 0; 3.8 0];
58 
59  sel = [2 9 13 19 25];
60  this = this@general.functions.PiecewiseLinear(curve(sel,1)" ,curve(sel,2) ");
61  this.l0= l0;
62  this.cdata= curve;
63  }
64 
65 
66  function str = getConfigStr() {
67  str = sprintf(" L_0=%g ",this.l0);
68  }
69 
70 
71  function plot(varargin) {
72  pm = plot@general.functions.PiecewiseLinear(this, varargin[:]);
73 
74  ax = pm.nextPlot(" gordon66_fit "," Splint fits "," length "," force ");
75  hold(ax," on ");
76 
77  [len, proc] = this.transform(this.cdata(:,1)" ,this.cdata(:,2) ");
78 
79  plot(len,proc," r-x ");
80 
81  /* PChip/Spline plots */
82  slen = linspace(min(len)*.99,max(len)*1.01,200);
83  sproc = spline(len,proc,slen);
84  pp = pchip(len,proc);
85  pproc = ppval(slen,pp);
86  plot(ax,slen,sproc," k- ",slen,pproc," m- ");
87 
88  pol = polyfit(len,proc,8);
89  /* fl = @(x)pol(1)*x.*x.*x + pol(2)*x.*x + pol(3)*x + pol(4); */
90  plot(ax,slen,polyval(pol,slen)," g ");
91 
92  axis(ax," tight ");
93  }
94 
95 
96 
97  protected:
98 
99  function [colvec<double>x , matrix<double>y ] = transform(colvec<double> x,matrix<double> y) {
100  x = x / this.l0;
101  }
102 
103 
104 
105 };
106 }
107 }
108 }
109 
110 
111 /* /* Speed te*/
112  Speed test
113  * all(1:3) = 0;
114  * for k=1:1000
115  * slen = min(len)*.99 + rand*(max(len)*1.01-min(len)*.99);
116  * t = tic;
117  * %sproc = spline(len,proc,slen);
118  * sproc = pchip(len,proc,slen);
119  * all(1) = all(1) + toc(t);
120  * l = rand*3;
121  * t = tic;
122  * fl(l);
123  * all(2) = all(2) + toc(t);
124  * t = tic;
125  * polyval(pol,slen);
126  * all(3) = all(3) + toc(t);
127  * end
128  * all / 1000
* polyval(pol, slen)
* fl(l)
A variable number of input arguments.
function [ colvec< double > x , matrix< double > y ] = transform(colvec< double > x,matrix< double > y)
Speed test * all(1:3)