nass-simscape/initialize/initializeSample.m

30 lines
784 B
Mathematica
Raw Normal View History

2018-10-25 11:00:30 +02:00
function [sample] = initializeSample(opts_param)
2018-06-16 22:57:54 +02:00
%% Default values for opts
sample = struct('radius', 100, ...
'height', 300, ...
'mass', 50, ...
'offset', 0, ...
'color', [0.45, 0.45, 0.45] ...
2018-06-16 22:57:54 +02:00
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
sample.(opt{1}) = opts_param.(opt{1});
end
end
2018-10-25 11:00:30 +02:00
%%
sample.k.x = 1e8;
sample.c.x = sqrt(sample.k.x*sample.mass)/10;
2018-06-16 22:57:54 +02:00
2018-10-25 11:00:30 +02:00
sample.k.y = 1e8;
sample.c.y = sqrt(sample.k.y*sample.mass)/10;
sample.k.z = 1e8;
sample.c.z = sqrt(sample.k.y*sample.mass)/10;
%% Save
save('./mat/stages.mat', 'sample', '-append');
2018-06-16 22:57:54 +02:00
end