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
MaxForce.m
Go to the documentation of this file.
1 namespace models{
2 namespace motorunit{
3 namespace experiments{
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 
20 function MaxForce() {
21 
22 file = fullfile(fileparts(mfilename(" fullpath "))," maxforces ");
23 
24 /* % Dynamic IC: yes, SinglePeak: no, OutScaling: no
25  * m = models.motorunit.Shorten(true, false, false);
26  *
27  * m.T = 2000;
28  * m.dt = .1;
29  * m.EnableTrajectoryCaching = false;
30  *
31  * % s = m.Sampler;
32  * % s.Samples = 1000;
33  * % s.Seed = 1;
34  * % m.off1_createParamSamples;
35  * % p = m.Data.ParamSamples;
36  * % % Sort samples by fibre type
37  * % [~, idx] = sort(p(1,:));
38  * % p = p(:,idx);
39  * % n = size(p,2);
40  *
41  * % Directly set parameter set
42  * n = 100;
43  * p = [linspace(0,1,n); 10*ones(1,n)];
44  *
45  * maxvals = zeros(1,n);
46  * maxpos = maxvals;
47  * pi = ProcessIndicator('Gathering max forces',n);
48  * parfor k=1:n
49  * [t, y] = m.simulate(p(:,k),1);%#ok
50  * [maxvals(k), pos] = max(y(2,:));
51  * maxpos(k) = pos;
52  * if pos == m.T+1
53  * fprintf('Max at final time for param %d\n',k);
54  * end
55  * pi.step;%#ok
56  * end
57  * pi.stop;
58  * save(file,'m','p','maxvals','maxidx','n'); */
59 
60 load(file);
61 pm = PlotManager;
62 pm.LeaveOpen= true;
63 
64 /* Load mean current limiting polynomial */
65 s = load(models.motoneuron.Model.FILE_UPPERLIMITPOLY);
66 eff_mean_current = polyval(s.upperlimit_poly,p(1,:));
67 
68 h = pm.nextPlot(" all "," fibre type "," values ");
69 plot(h,p(1,:),maxvals," r ",p(1,:),eff_mean_current," b ");
70 
71 /* Polynomial fit */
72 hold(h," on ");
73 coeff = polyfit(p(1,:),maxvals,4);
74 ax = 0:.01:1;
75 ay = polyval(coeff,ax);
76 plot(h,ax,ay," r-- ");
77 legend(" Max activation "," Effective mean current "," Approx max activation ");
78 pm.done;
79 /* save(file,'coeff','-APPEND'); */
80 file = fullfile(fileparts(mfilename(" fullpath "))," maxforces_poly ");
81 save(file," coeff ");
82 }
95 };
96 };
97 };
* polyval(pol, slen)
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
logical LeaveOpen
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) ...
Definition: PlotManager.m:213
function MaxForce()
Script to determine the maximum force created by the sarcomere at maximum mean current for each fibre...
Definition: MaxForce.m:20