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
SarcoScaling.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 SarcoScaling() {
21 
22 file = fullfile(fileparts(mfilename(" fullpath "))," sarcoscaling ");
23 
24 /* m = models.motorunit.Shorten(true, true);
25  *
26  * m.T = 80;
27  * m.dt = .1;
28  * m.EnableTrajectoryCaching = false;
29  *
30  * % s = m.Sampler;
31  * % s.Samples = 1000;
32  * % s.Seed = 1;
33  * % m.off1_createParamSamples;
34  * % p = m.Data.ParamSamples;
35  * % % Sort samples by fibre type
36  * % [~, idx] = sort(p(1,:));
37  * % p = p(:,idx);
38  *
39  * % Directly set parameter set
40  * p = [linspace(0,1,60); linspace(2,3,60)];
41  *
42  * n = size(p,2);
43  * maxvals = zeros(1,n);
44  * maxidx = [];
45  * pi = ProcessIndicator('Gathering max forces',n);
46  * parfor k=1:n
47  * [t, y, ct, x] = m.simulate(p(:,k),1);%#ok
48  * [maxvals(k), pos] = max(x(59,:));
49  * if pos == m.T+1
50  * fprintf('Max at final time for param %d\n',k);
51  * maxidx = [maxidx k];
52  * end
53  * pi.step;%#ok
54  * end
55  * pi.stop;
56  * save(file,'m','p','maxvals','maxidx'); */
57 
58 load(file);
59 pm = PlotManager(false,2,2);
60 tri = delaunay(p(1,:),p(2,:));
61 h = pm.nextPlot(" all ");
62 trisurf(tri, p(1,:),p(2,:),maxvals," Parent ",h, " FaceColor "," interp "," EdgeColor "," interp ");
63 
64 /* m.Sampler.Domain = MotoneuronParamDomain; */
65 [~, idx] = m.Sampler.Domain.filter(p);
66 /* tri = delaunay(p(1,idx),p(2,idx));
67  * h = pm.nextPlot('valid');
68  * trisurf(tri, p(1,idx),p(2,idx), maxvals(idx), 'Parent',h, 'FaceColor','interp','EdgeColor','interp'); */
69 
70 x = p(1,idx);
71 y = 1./maxvals(idx);
72 h = pm.nextPlot(" all ");
73 plot(h, x, y);
74 axis(h," tight ");
75 
76 /* Polynomial fit */
77 h = pm.nextPlot(" all ");
78 plot(h,x,y);
79 hold(h," on ");
80 c = polyfit(x,y,12);
81 ax = 0:.01:1;
82 ay = polyval(c,ax);
83 plot(h,ax,ay," r ");
84 axis(h," tight ");
85 save(file," c "," -APPEND ");
86 }
106 };
107 };
108 };
function SarcoScaling()
Script to create an output force scaling for the Shorten sarcomere model. The assumption is to have t...
Definition: SarcoScaling.m:20
* polyval(pol, slen)
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17